@@ -33,6 +33,7 @@ async function run() {
33
33
const commitMessageSubjectMaxLength = parseInt ( core . getInput ( 'commit-message-subject-max-length' ) )
34
34
const commitMessageSubjectMinLength = parseInt ( core . getInput ( 'commit-message-subject-min-length' ) )
35
35
36
+ const prohibitBlankLinesCmBody = ( core . getInput ( 'prohibit-blank-lines-cm-body' ) == 'true' )
36
37
const prohibitUnknownCommitAuthors = ( core . getInput ( 'prohibit-unknown-commit-authors' ) == 'true' )
37
38
const prohibitUnknownCommitCommitters = ( core . getInput ( 'prohibit-unknown-commit-committers' ) == 'true' )
38
39
const prohibitUnsignedCommits = ( core . getInput ( 'prohibit-unsigned-commits' ) == 'true' )
@@ -73,10 +74,10 @@ async function run() {
73
74
core . info ( `Commit hash: ${ commit . sha } ` )
74
75
core . info ( `Commit author email: ${ commit . commit . author . email } ` )
75
76
core . info ( `Commit author name: ${ commit . commit . author . name } ` )
76
- core . info ( `Commit author GitHub account: ${ commit . author } ` )
77
+ core . info ( `Commit author GitHub account: ${ commit . author == null ? undefined : commit . author . login } ` )
77
78
core . info ( `Commit committer email: ${ commit . commit . committer . email } ` )
78
79
core . info ( `Commit committer name: ${ commit . commit . committer . name } ` )
79
- core . info ( `Commit committer GitHub account: ${ commit . committer } ` )
80
+ core . info ( `Commit committer GitHub account: ${ commit . committer == null ? undefined : commit . committer . login } ` )
80
81
core . info ( `Commit has valid signature: ${ commit . commit . verification . verified } ` )
81
82
core . info ( `Commit message subject: ${ commitMessageSubject } ` )
82
83
core . info ( `Commit message body: ${ commitMessageBody } ` )
@@ -118,8 +119,12 @@ async function run() {
118
119
// Check commit message body
119
120
if ( commitMessageBody != null ) {
120
121
commitMessageBody . split ( "\n" ) . forEach ( function ( line , index ) {
121
- if ( commitMessageBodyMinLength != - 1 && line . length < commitMessageBodyMinLength )
122
+ if ( line . length == 0 ) {
123
+ if ( prohibitBlankLinesCmBody )
124
+ core . setFailed ( `Blank lines are not allowed in commit message body; line ${ ( index + 1 ) . toString ( ) } (${ commit . sha . substr ( 0 , 7 ) } )` )
125
+ } else if ( commitMessageBodyMinLength != - 1 && line . length < commitMessageBodyMinLength ) {
122
126
core . setFailed ( `Commit message body line ${ ( index + 1 ) . toString ( ) } is too short (${ commit . sha . substr ( 0 , 7 ) } )` )
127
+ }
123
128
124
129
if ( commitMessageBodyMaxLength != - 1 && line . length > commitMessageBodyMaxLength )
125
130
core . setFailed ( `Commit message body line ${ ( index + 1 ) . toString ( ) } is too long (${ commit . sha . substr ( 0 , 7 ) } )` )
0 commit comments