Trigger pipeline ONLY when MR is Approved

Hello,

Im trying to make my job to trigger ONLY if the Merge Request if approved and merged into main branch? and what I have currently is not working…

  rules:
    - if: $CI_MERGE_REQUEST_APPROVED == true
      changes:
          paths:
            - $TRACK_DIR/$TRACK_NAME/*/*
      when: always

Hi @sunnyruziev

You need to add `$CI_PIPELINE_SOURCE == “merge_request_event” to the condition so the job runs in Merge request pipeline.

Rule should look like this:

rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_APPROVED == true
      changes:
          paths:
            - $TRACK_DIR/$TRACK_NAME/*/*
      when: always