How to trigger a pipeline on master when a merge request is raised against master in GitLab CI

The scenario is

I cut a branch from master(default) named Test and make a bunch of commits to it.

I have mentioned in the pipeline file in master to run only on merge requests like shown below

rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'

I also tried like this

only:
- merge_requests

Requirement

The pipeline on the master branch should get triggered(and not the pipeline in the test branch) when you raise a merge request from Test --> master.

Current behavior

When I raise an MR from Test --> Master, the pipeline code which is in Test is getting executed and not the one in master.

How can we get the expected behavior? Any help would be appreciated.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum