Auto stop environments for triggered pipelines in merge requests

Hi there,
can somebody please help me out in the following github issue?
I’m trying to create a ci pipeline on gitlab.com where the main job will trigger another pipeline from a file which will create an environment (example repo with test pipelines: Attila Csoma / env-test · GitLab).
My goal is to use the triggered job to create an environment and delete it when I delete the branch which triggered the pipeline (last line in this paragraph: Environments and deployments | GitLab).

Now my pipeline looks like this:
gitlab-ci.yml:

stages:
    - test
test_pipeline:
  stage: test
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
  trigger:
    include:
      - local: pipeline.yaml
    strategy: depend

pipeline.yaml

workflow:
  rules:
   - when: always
deploy_review:
  stage: deploy
  image: busybox:1.33.1-glibc
  script:
    - echo "Deploy a review app"
  environment:
    name: review/$CI_COMMIT_REF_NAME
    url: https://$CI_ENVIRONMENT_SLUG.example.com
    on_stop: stop_review
stop_review:
  stage: deploy
  image: busybox:1.33.1-glibc
  script:
    - echo "Remove review app"
  environment:
    name: review/$CI_COMMIT_REF_NAME
    action: stop
  rules:
    - when: manual
      allow_failure: true

The issue is that if I use ‘push’ in gitlab-ci.yml in test_pipeline.rules.[].if ( - if: '$CI_PIPELINE_SOURCE == "push"' ) everything works fine. After a push event it will trigger
the pipeline, which will create the environment and if I delete the branch it will trigger the stop_review job.
However, if I try to limit it to start the pipeline only for merge requests (so use the merge_request_event as CI_PIPELINE_SOURCE) then if I open merge request it will start the ci which will create the environment but if I merge the merge request with delete source branch option enabled it will not trigger the stop_review event (the branch will be deleted however).
I didn’t found any reference in the documentation that it should not work (the env auto stop feature) for merge requests too. Maybe I’m missing something. I tried the gitlab api to look for any differences between a working and non working environment/deployment json structure but didn’t found anything.

Any help would be appreciated :slight_smile:
Thanks in advance