Skip to content

Don't run CI pipeline on empty branch

Minor petpeeve, but we currently run the CI, even if the branch has no changes compared to main. This is rather pointless and wastest resource. Luckily there is an easy way to disable this. From the GitLab documentation:

job:
  script:
    - echo "This job only runs for branches that are not empty"
  rules:
    - if: $CI_COMMIT_BRANCH
      changes:
        compare_to: 'refs/heads/main'
        paths:
          - '**/*'

This is for a job, but we should be able to set this in the workflow rules to easily skip the pipeline.