Create pipelines rules

Create Pipeline Rules

I have a question, I need to make a rule that allows me to trigger a pipeline when I commit to a branch and when a tag is created from it. The rule should basically allow the pipeline to be triggered when a commit or a tag is created from a branch, but not when an MR is made or a tag is created from those MR.

    - if : ($CI_COMMIT_TAG && $CI_COMMIT_REF_NAME != "main")
      when: always
    - if: $CI_COMMIT_REF_NAME != "factory"
      when: never
  • That was what I tried and it works in its branch, but when merging in main the pipeline is also executed.
  • When I create a tag from main, it is also executed

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Hi, do you can add the state variable or value with the merge in the rule?
$CI_PIPELINE_SOURCE == "merge_request_event"


1 Like