I was able to ignore directory, file changes using the following syntax.
build:
script: npm run build
except:
changes:
- "*.md"
- "src/**/*.ts"
With this configuration build
job is going to run except git changes include only *.md
extension file or *.ts
files in src
directory. They're ignored.
But then they deprecated this only:changes
, except:changes
syntax and warned to use rules
syntax instead. Unfortunately, I cannot seem to find how to ignore directory, file changes using this new syntax.
Based on documents of rules: changes
, it seems when: never
must be used with rules: changes
syntax. Like the following:
build:
script: npm run build
rules:
- changes:
- "*.md"
- "src/**/*.ts"
when: never
- when: always
If changed paths in the repository match above regular expressions then the job will not be added to any pipeline. In other cases the job always will be run by pipelines.