File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const fs = require('fs')
88const rootScopes = [ 'deps' , 'other' ] // Scopes where modified files are typically in the repo's root.
99const dotScopes = { github : '.github' } // Scopes that map to dotfolders
1010const bypassScopes = [ 'publish' ] // Scopes that bypass the check and allow any file to be modified in a commit.
11+ const excludedFiles = [ '.all-contributorsrc' , 'README.md' ] // Files that can be modified with any scope.
1112
1213const getCommitScope = ( ) => {
1314 const commitMessage = fs . readFileSync ( process . argv [ 3 ] , 'utf8' )
@@ -34,9 +35,10 @@ if (bypassScopes.indexOf(commitScope) === -1) {
3435 . map ( element => element . replace ( '-' , '' ) )
3536 . forEach ( element => {
3637 if (
37- ( rootScopes . indexOf ( commitScope ) === - 1 &&
38+ ( ( rootScopes . indexOf ( commitScope ) === - 1 &&
3839 element . search ( new RegExp ( `^(.*(/+)|(/?))${ commitScope } /` , 'i' ) ) === - 1 ) ||
39- ( rootScopes . indexOf ( commitScope ) !== - 1 && element . search ( / ( \\ ) | ( \/ ) / g) !== - 1 )
40+ ( rootScopes . indexOf ( commitScope ) !== - 1 && element . search ( / ( \\ ) | ( \/ ) / g) !== - 1 ) ) &&
41+ excludedFiles . indexOf ( element ) === - 1
4042 ) {
4143 console . error (
4244 '\n' ,
You can’t perform that action at this time.
0 commit comments