Run CI job on removing WIP from MR

Referring to:


and
https://docs.gitlab.com/ee/ci/variables/

It should be possible to run the CI when WIP is removed from the title of a merge request. This, however, doesn’t seem to be true. What does work is that the CI doesn’t trigger as log as the title starts with WIP: or [WIP], but on removing the WIP: from the title of the MR, the pipeline doesn’t trigger at all.

build--on-no-wip:
  stage: build
  only:
    refs:
      - merge_requests
  except:
    variables:
      - $CI_MERGE_REQUEST_TITLE =~ /^WIP:/
      - $CI_MERGE_REQUEST_TITLE =~ /^[WIP]/
  script:
    - echo "No WIP job!"
    - echo $CI_MERGE_REQUEST_TITLE
    
run-on-mr:
  stage: build
  only:
    refs:
      - merge_requests
  script:
    - echo "No WIP pipelines!"
    - echo $CI_MERGE_REQUEST_TITLE

run-always:
  stage: build
  script:
    - echo "No WIP pipelines!"
    - echo $CI_MERGE_REQUEST_TITLE

How can I make some CI jobs only run when WIP: is removed from the title?

Thx!

2 Likes