Multiple if clauses for workflow:rules

This is what I have in my .gitlab-ci.yml

    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE =~ /Setting version/'
        - version.sbt
      when: never
    - if: '$CI_PIPELINE_SOURCE == "trigger"'

I found that I cannot trigger pipeline to run on default branch via API when the latest commit in default branch has Setting version as commit message.

Basically I want the pipeline to always get triggered regardless of branch and commit message. If I just rearrange entry of rules by moving the 2nd rule to be the 1st rule. Will it bypass other rules defined below it?

Yes, it will. The rules are evaluated in order defined and first rule that matches is last one evaluated. In other words, all rules below the first match are ignored.

1 Like

Thank you so much.