@@ -199,7 +199,7 @@ export class Utils {
199199 for ( const rule of opt . rules ) {
200200 if ( ! Utils . evaluateRuleIf ( rule . if , opt . variables ) ) continue ;
201201 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 ;
203203
204204 when = rule . when ? rule . when : jobWhen ;
205205 allowFailure = rule . allow_failure ?? allowFailure ;
@@ -337,7 +337,7 @@ export class Utils {
337337 return false ;
338338 }
339339
340- static evaluateRuleChanges ( defaultBranch : string , ruleChanges : string [ ] | { paths : string [ ] } | undefined ) : boolean {
340+ static evaluateRuleChanges ( defaultBranch : string , ruleChanges : string [ ] | { paths : string [ ] } | undefined , cwd : string ) : boolean {
341341 if ( ruleChanges === undefined ) return true ;
342342
343343 // Normalize rules:changes:paths to rules:changes
@@ -346,7 +346,7 @@ export class Utils {
346346 // NOTE: https://docs.gitlab.com/ee/ci/yaml/#ruleschanges
347347 // Glob patterns are interpreted with Ruby's [File.fnmatch](https://docs.ruby-lang.org/en/master/File.html#method-c-fnmatch)
348348 // 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 , {
350350 nonegate : true ,
351351 noextglob : true ,
352352 posix : false ,
0 commit comments