GitLab CI: Do not trigger jobs when new branch is created

Viewed 1172

I noticed that when I create a new branch, Gitlab-CI is triggered to run the job. How do I disable this in .gitlab-ci.yml?

2 Answers

Try

workflow:
  rules:
  - if: $CI_PIPELINE_SOURCE == "web"
    when: never

or use the outlined if: condition in any number of jobs you do not want to have started on branch creation. Note, however, that this condition also (to my understanding) suppresses pipelines if you make any commits via WebIDE. If you insist on having those, you'll probably have to check for $CI_PIPELINE_SOURCE == "web" && $CI_PIPELINE_SOURCE != "webide" (but I have not tested if that works).

Related