File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -104,9 +104,8 @@ const formatErrors = lintedCommits =>
104
104
105
105
const hasOnlyWarnings = lintedCommits =>
106
106
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 )
110
109
111
110
const setFailed = formattedResults => {
112
111
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', () => {
400
400
401
401
beforeEach ( async ( ) => {
402
402
cwd = await git . bootstrap ( 'fixtures/conventional' )
403
+ await gitEmptyCommit ( cwd , 'chore: previous commit' )
404
+ await gitEmptyCommit ( cwd , 'chore: correct message with no warnings' )
403
405
await gitEmptyCommit (
404
406
cwd ,
405
407
'chore: correct message\nsome context without leading blank line' ,
406
408
)
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 } )
409
411
updatePushEnvVars ( cwd , to )
410
412
td . replace ( process , 'cwd' , ( ) => cwd )
411
413
td . replace ( console , 'log' )
@@ -419,6 +421,13 @@ describe('Commit Linter action', () => {
419
421
errors : [ ] ,
420
422
warnings : [ 'body must have leading blank line' ] ,
421
423
} ,
424
+ {
425
+ hash : from ,
426
+ message : 'chore: correct message with no warnings' ,
427
+ valid : true ,
428
+ errors : [ ] ,
429
+ warnings : [ ] ,
430
+ } ,
422
431
]
423
432
} )
424
433
You can’t perform that action at this time.
0 commit comments