Can Gitlab Stage be triggered only after the merge request is merged to the target branch

**Pipeline stage should only trigger when the merge request event is merged

  - int

  stage: int
  image: docker:20.10.16
    - echo "this is testing commit for tagging"
    - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "feat-reltag" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "rel1.0" && $CI_PIPELINE_SOURCE == "merge_request_event"

The above stage will trigger as soon as a merge request is created. But I need to trigger only when that is merged to the target branch. Tried a lot by looking at the gitlab docs, but in vain.

Really appreciate if someone could help on this

If you want run a job AFTER the merge then you can just look for changes on the branch it is merging into. For example if I am coding on a “dev” branch and I merge it into “main” then using the following code will run a job only when the code in the “main” branch is updated.

    - if: "$CI_COMMIT_BRANCH" == "main"