@@ -6,6 +6,7 @@ const buildSquashCommit = require('./build-squash-commit');
6
6
7
7
const IF_CI = ! ! argv . ifCi ;
8
8
const PR_ONLY = ! ! argv . prOnly ;
9
+ const ALLOW_SQUASH = ! ! argv . allowSquash ;
9
10
10
11
// Allow override of used bins for testing purposes
11
12
const COMMITLINT = process . env . JENKINS_COMMITLINT_BIN ;
@@ -73,13 +74,17 @@ async function lintPR() {
73
74
74
75
// Kick off the work to figure out the appropriate squash commit. We may not use it, provided
75
76
// the commit range itself consists of valid commits.
76
- const squashCommitPromise = buildSquashCommit ( {
77
- pullNumber : parseInt ( CHANGE_ID , 10 ) ,
78
- ...range ,
79
- } ) ;
77
+ const squashCommitPromise = ALLOW_SQUASH
78
+ ? buildSquashCommit ( {
79
+ pullNumber : parseInt ( CHANGE_ID , 10 ) ,
80
+ ...range ,
81
+ } )
82
+ : null ;
80
83
81
84
// Prevent unhandled rejections.
82
- squashCommitPromise . catch ( ( ) => { } ) ;
85
+ if ( squashCommitPromise ) {
86
+ squashCommitPromise . catch ( ( ) => { } ) ;
87
+ }
83
88
84
89
let branchCommitlintOutput ;
85
90
try {
@@ -95,6 +100,13 @@ async function lintPR() {
95
100
throw err ;
96
101
}
97
102
103
+ if ( ! ALLOW_SQUASH ) {
104
+ console . error ( 'Errors found in branch commits' ) ;
105
+ console . group ( ) ;
106
+ console . error ( err . all ) ;
107
+ console . groupEnd ( ) ;
108
+ throw err ;
109
+ }
98
110
branchCommitlintOutput = err . all ;
99
111
}
100
112
0 commit comments