Reputation: 101
I have a project with a working GitLab-CI configuration, but I only want to create and execute a pipeline, when one of my config files are changed. Is there a way to check for changed files within the gitlab-ci.yml and only execute, when specified files are changed?
Upvotes: 1
Views: 2821
Reputation: 1978
Yes, using changes
: add or exclude jobs from a pipeline based on what files are changed. Same as only:changes
.
https://docs.gitlab.com/ee/ci/yaml/#onlychangesexceptchanges
Warning: If using only:changes with only allow merge requests to be merged if the pipeline succeeds, undesired behavior could result if you don’t also use only:merge_requests.
Also, it's always evaluates as “true” in Scheduled pipelines. All files are considered to have “changed” when a scheduled pipeline runs.
Upvotes: 3