@@ -21,7 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
22
22
const core = __importStar ( require ( "@actions/core" ) ) ;
23
23
const github = __importStar ( require ( "@actions/github" ) ) ;
24
- const node_fetch_1 = __importStar ( require ( "node-fetch" ) ) ;
24
+ const child_process_1 = require ( "child_process" ) ;
25
25
var INPUT_PARAMS ;
26
26
( function ( INPUT_PARAMS ) {
27
27
INPUT_PARAMS [ "SKIP_ON_COMMIT_MSG" ] = "skipOnCommitMsg" ;
@@ -55,22 +55,22 @@ async function run() {
55
55
}
56
56
core . info ( `sha: ${ sha } ` ) ;
57
57
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 ;
73
70
}
71
+ // } else {
72
+ // core.setFailed(`could not find commit for sha ${sha} -> got status code ${response.status}: ${response.statusText}`)
73
+ // }
74
74
}
75
75
core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , true ) ;
76
76
}
0 commit comments