@@ -21,7 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
2121Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2222const core = __importStar ( require ( "@actions/core" ) ) ;
2323const github = __importStar ( require ( "@actions/github" ) ) ;
24- const node_fetch_1 = __importStar ( require ( "node-fetch" ) ) ;
24+ const child_process_1 = require ( "child_process" ) ;
2525var INPUT_PARAMS ;
2626( function ( INPUT_PARAMS ) {
2727 INPUT_PARAMS [ "SKIP_ON_COMMIT_MSG" ] = "skipOnCommitMsg" ;
@@ -55,22 +55,22 @@ async function run() {
5555 }
5656 core . info ( `sha: ${ sha } ` ) ;
5757 if ( sha ) {
58- const q = `hash:${ sha } ` ;
59- console . info ( `q: ${ q } ` ) ;
60- const response = await ( 0 , node_fetch_1 . default ) ( `https://api.github.com/repos/shiftcode/sc-commons/git/commits/${ sha } ` , { headers : new node_fetch_1 . Headers ( { Authorization : `token ${ ghToken } ` } ) } ) ;
61- if ( response . status >= 200 && response . status < 300 ) {
62- // ok
63- const commit = await response . json ( ) ;
64- const commitMessage = commit . message ;
65- core . info ( `commit message to check against ${ commitMessage } ` ) ;
66- if ( commitMessage . includes ( skipOnCommitMsg ) ) {
67- core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , false ) ;
68- return ;
69- }
70- }
71- else {
72- core . setFailed ( `could not find commit for sha ${ sha } -> got status code ${ response . status } : ${ response . statusText } ` ) ;
58+ const commitMessage = ( 0 , child_process_1 . execSync ) ( `git log --format=%B -n 1 ${ sha } ` , { encoding : 'utf8' } ) . trim ( ) ;
59+ // const q = `hash:${sha}`
60+ // console.info(`q: ${q}`)
61+ // const response = await fetch(`https://api.github.com/repos/shiftcode/sc-commons/git/commits/${sha}`, { headers: new Headers({ Authorization: `token ${ghToken}` }) })
62+ // if (response.status >= 200 && response.status < 300) {
63+ // // ok
64+ // const commit = await response.json() as { message: string }
65+ // const commitMessage = commit.message as string
66+ core . info ( `commit message to check against ${ commitMessage } ` ) ;
67+ if ( commitMessage . includes ( skipOnCommitMsg ) ) {
68+ core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , false ) ;
69+ return ;
7370 }
71+ // } else {
72+ // core.setFailed(`could not find commit for sha ${sha} -> got status code ${response.status}: ${response.statusText}`)
73+ // }
7474 }
7575 core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , true ) ;
7676 }
0 commit comments