Gitlab change from only/except to rules for control ci, what will be alternative for it

Viewed 340

Recently Git-lab change only/except to rules. so if i have below only in my .gitlab-ci.yaml, what will be equivalent rules for it.

  only:
    - merge_requests
    - triggers
1 Answers

Use rules like this :

rules:
 - if: $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "merge_request_event"
   when: on_success
Related