Disable CI/CD pipelines when merge request is updated

We have a Gitlab pipeline that is currently running on every commit that is pushed to the repository. We would like to run the pipeline only in two phases. When merge request is created and when merge request is merged, NOT when merge request is updated. Reason for this is that all the same steps are done pre commit locally and in the pipeline. So its useless to run the pipelines and block the merge when new commits are added to merge request.

Currently gitlab-ci.yml file has these workflow rules.

In the screenshot the $CI_COMMIT_BRANCH is pipelien-test for testing purposes. If this solution would work the branch there would be master or main branch.

I have been playing around with different rules for a while to achieve the behavior that I described earlier. I tried also using the “only_merge_requests” keyword in every job that I have and also add it to the workflow rules. Problem is that the “only_merge_requests” is still triggering the pipeline when a merge request is updated.