File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,19 @@ var blocked_statements = [
16
16
] ;
17
17
18
18
var blockedRegex = new RegExp ( '\\+.*(' + blocked_statements . join ( '|' ) + ').*$' , 'mg' ) ;
19
+ var commit_range = process . env . TRAVIS_COMMIT_RANGE || 'HEAD~1' ;
19
20
20
- var diff = child_process . execSync ( 'git diff --unified=0 HEAD~1 ./src ./e2e' ) . toString ( ) ;
21
- var isInvalid = blockedRegex . test ( diff ) ;
21
+ var diff = child_process . execSync (
22
+ 'git diff --unified=0 ' + commit_range + ' ./src ./e2e'
23
+ ) . toString ( ) ;
24
+
25
+ if ( blockedRegex . test ( diff ) ) {
22
26
23
- if ( isInvalid ) {
24
27
console . warn ( 'Warning: You are using a statement in your commit, which is not allowed.\n' +
25
28
'Blocked Statements are: ' + blocked_statements . join ( ', ' ) + '\n' +
26
29
'Please remove them, and the CI will continue.' ) ;
27
30
process . exit ( 1 ) ;
31
+
28
32
} else {
29
33
console . log ( 'Info: The commits have been analyzed and are valid!' ) ;
30
34
}
You can’t perform that action at this time.
0 commit comments