CI Pipeline ordering with CI_MERGE_REQUEST_TARGET_BRANCH_NAME before Merge Request made?
How are you supposed to consistently use CI_MERGE_REQUEST_TARGET_BRANCH_NAME in CI pipelines which are meant to run only:
against merge request branches, if the pipeline gets kicked off at push-time, rather than when I make the merge request? Seems like a bootstrapping problem ... sometimes CI_MERGE_REQUEST_TARGET_BRANCH_NAME will be there (if the MR already exists) but sometimes it won't be there. How are other people using this variable consistently?
further context
Our team's CI pipeline uses the Merge Request title to calculate whether we should take a major, minor, or patch version bump when merging in a commit. More specifically, we have CI scripts which look for the strings [major]
/ [minor]
/ [patch]
in the most recent commit message. The most recent commit message has the Merge Request title in it because we use merge requests rather than fast-forward & rebase merging.
When someone proposes a merge request, we want to verify that their merge request title has an appropriate version bump label. We have concocted a two step approach.
Step 1 is a CI job "wait for MR" which waits an hour after a branch is first pushed to see if an MR will be made.
Step 2 is a CI job which uses the variables.