@@ -199,7 +199,7 @@ export class Utils {
199
199
for ( const rule of opt . rules ) {
200
200
if ( ! Utils . evaluateRuleIf ( rule . if , opt . variables ) ) continue ;
201
201
if ( ! Utils . evaluateRuleExist ( opt . cwd , rule . exists ) ) continue ;
202
- if ( evaluateRuleChanges && ! Utils . evaluateRuleChanges ( gitData . branches . default , rule . changes ) ) continue ;
202
+ if ( evaluateRuleChanges && ! Utils . evaluateRuleChanges ( gitData . branches . default , rule . changes , opt . cwd ) ) continue ;
203
203
204
204
when = rule . when ? rule . when : jobWhen ;
205
205
allowFailure = rule . allow_failure ?? allowFailure ;
@@ -337,7 +337,7 @@ export class Utils {
337
337
return false ;
338
338
}
339
339
340
- static evaluateRuleChanges ( defaultBranch : string , ruleChanges : string [ ] | { paths : string [ ] } | undefined ) : boolean {
340
+ static evaluateRuleChanges ( defaultBranch : string , ruleChanges : string [ ] | { paths : string [ ] } | undefined , cwd : string ) : boolean {
341
341
if ( ruleChanges === undefined ) return true ;
342
342
343
343
// Normalize rules:changes:paths to rules:changes
@@ -346,7 +346,7 @@ export class Utils {
346
346
// NOTE: https://docs.gitlab.com/ee/ci/yaml/#ruleschanges
347
347
// Glob patterns are interpreted with Ruby's [File.fnmatch](https://docs.ruby-lang.org/en/master/File.html#method-c-fnmatch)
348
348
// with the flags File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_EXTGLOB.
349
- return micromatch . some ( GitData . changedFiles ( `origin/${ defaultBranch } ` ) , ruleChanges , {
349
+ return micromatch . some ( GitData . changedFiles ( `origin/${ defaultBranch } ` , cwd ) , ruleChanges , {
350
350
nonegate : true ,
351
351
noextglob : true ,
352
352
posix : false ,
0 commit comments