@@ -44,6 +44,7 @@ async function run() {
4444 case 'pull_request' :
4545 core . info ( JSON . stringify ( github . context . payload . pull_request ) ) ;
4646 sha = github . context . payload . pull_request ?. head . sha ?? `unknown` ;
47+ break ;
4748 case 'push' :
4849 sha = github . context . sha ;
4950 break ;
@@ -55,18 +56,20 @@ async function run() {
5556 if ( sha ) {
5657 const q = `hash:${ sha } ` ;
5758 console . info ( `q: ${ q } ` ) ;
58- const response = await octokit . rest . search . commits ( { q } ) ;
59- core . info ( `count of commits ${ response . data . total_count } ` ) ;
60- for ( const { commit } of response . data . items ) {
61- core . info ( `message: ${ commit . url } `) ;
62- core . info ( `message: ${ commit . message } ` ) ;
59+ const { data } = await octokit . rest . search . commits ( { q } ) ;
60+ core . info ( `found ${ data . total_count } commits for sha ${ sha } ` ) ;
61+ if ( data . total_count === 0 ) {
62+ core . setFailed ( `could not find commit with sha ${ sha } `) ;
63+ return ;
6364 }
64- if ( true ) {
65- core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , true ) ;
65+ const commitMessage = data . items [ 0 ] . commit . message ;
66+ core . info ( `commit message to check against ${ commitMessage } ` ) ;
67+ if ( commitMessage . includes ( skipOnCommitMsg ) ) {
68+ core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , false ) ;
6669 return ;
6770 }
6871 }
69- core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , false ) ;
72+ core . setOutput ( OUTPUT_PARAMS . SHOULD_EXECUTE , true ) ;
7073 }
7174 catch ( error ) {
7275 core . error ( 'there was an error' ) ;
0 commit comments