run pipeline before merge request gitlab code example

Example 1: gitlab ci run pipeline only when new merge request created

Gitlab CI only run on Merge Request
To configure pipelines for merge requests, 
add the only: [merge_requests] parameter to 
the jobs that you want to run only for merge requests. 
Then, when developers create or update merge requests, 
a pipeline runs every time a commit is pushed to GitLab.

Example 2: merge when pipeline succeeds gitlab

enable_merge:
  only: [merge_requests]
  script:
    - echo true

Tags:

Misc Example