Your job should look like this

test:
  stage: test
  script:
    - echo "Running this pipeline only for merge requests"
  only:
    - merge_requests