File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -104,9 +104,8 @@ const formatErrors = lintedCommits =>
104104
105105const hasOnlyWarnings = lintedCommits =>
106106 lintedCommits . length &&
107- lintedCommits . every (
108- ( { lintResult } ) => lintResult . valid && lintResult . warnings . length ,
109- )
107+ lintedCommits . every ( ( { lintResult } ) => lintResult . valid ) &&
108+ lintedCommits . some ( ( { lintResult } ) => lintResult . warnings . length )
110109
111110const setFailed = formattedResults => {
112111 core . setFailed ( `You have commit messages with errors\n\n${ formattedResults } ` )
Original file line number Diff line number Diff line change @@ -400,12 +400,14 @@ describe('Commit Linter action', () => {
400400
401401 beforeEach ( async ( ) => {
402402 cwd = await git . bootstrap ( 'fixtures/conventional' )
403+ await gitEmptyCommit ( cwd , 'chore: previous commit' )
404+ await gitEmptyCommit ( cwd , 'chore: correct message with no warnings' )
403405 await gitEmptyCommit (
404406 cwd ,
405407 'chore: correct message\nsome context without leading blank line' ,
406408 )
407- const [ to ] = await getCommitHashes ( cwd )
408- await createPushEventPayload ( cwd , { to } )
409+ const [ before , from , to ] = await getCommitHashes ( cwd )
410+ await createPushEventPayload ( cwd , { before , to } )
409411 updatePushEnvVars ( cwd , to )
410412 td . replace ( process , 'cwd' , ( ) => cwd )
411413 td . replace ( console , 'log' )
@@ -419,6 +421,13 @@ describe('Commit Linter action', () => {
419421 errors : [ ] ,
420422 warnings : [ 'body must have leading blank line' ] ,
421423 } ,
424+ {
425+ hash : from ,
426+ message : 'chore: correct message with no warnings' ,
427+ valid : true ,
428+ errors : [ ] ,
429+ warnings : [ ] ,
430+ } ,
422431 ]
423432 } )
424433
You can’t perform that action at this time.
0 commit comments