Trigger stage on merge of branch

Hi all,

I tried googling a solution to this and also used this forum, but I couldn’t find an answer. I am trying to trigger a job only when a branch is merged into a specific branch and the Pipfile is change, and I fail to make it work. Maybe someone here can help me?

Here is the config I have:

"Cleanup":
  stage: cleanup
  image: docker:stable-git
  tags:
    - docker
    - cloud
  rules:
    - if: '$CI_COMMIT_BRANCH == "develop" && $CI_COMMIT_TITLE =~ /^Merge branch/'
      changes:
        - "Pipfile"
  before_script:
    - docker login -u $REGISTRY_USER -p $REGISTRY_PASSWORD $REGISTRY
    - az login --service-principal -u $AKS_USER -p $AKS_PASSWORD --tenant $AKS_TENANT
    - az acr login --name sodexo.azurecr.io
  script:
    - BRANCH_NAME=$(echo $CI_COMMIT_TITLE | cut -c15- | rev | cut -c17- | rev)
    - (docker pull ${REGISTRY}/${IMAGE_NAME}:install-${BRANCH_NAME} && az acr repository delete --name ${REGISTRY} --image ${IMAGE_NAME}:install-${BRANCH_NAME}) || true