@@ -6,6 +6,7 @@ const buildSquashCommit = require('./build-squash-commit');
66
77const IF_CI = ! ! argv . ifCi ;
88const PR_ONLY = ! ! argv . prOnly ;
9+ const ALLOW_SQUASH = ! ! argv . allowSquash ;
910
1011// Allow override of used bins for testing purposes
1112const COMMITLINT = process . env . JENKINS_COMMITLINT_BIN ;
@@ -73,13 +74,17 @@ async function lintPR() {
7374
7475 // Kick off the work to figure out the appropriate squash commit. We may not use it, provided
7576 // 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 ;
8083
8184 // Prevent unhandled rejections.
82- squashCommitPromise . catch ( ( ) => { } ) ;
85+ if ( squashCommitPromise ) {
86+ squashCommitPromise . catch ( ( ) => { } ) ;
87+ }
8388
8489 let branchCommitlintOutput ;
8590 try {
@@ -95,6 +100,13 @@ async function lintPR() {
95100 throw err ;
96101 }
97102
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+ }
98110 branchCommitlintOutput = err . all ;
99111 }
100112
0 commit comments