How can I set rules on the pipeline job to run only when I created new branch from master branch

The idea is to detect when branch is created from master and run specific job in pipeline.

I can get the new branch name using these vars: $CI_COMMIT_REF_NAME and $CI_COMMIT_BRANCH

But how do I get the branch name I created the new one from?

Is this in an MR? If so, the predefined variables have variables for the MR branch names.

This is on commit to version branch at creation of new branch from master.

I found a little workaround, I just check that $CI_COMMIT_BRANCH is development and last commit was merge commit. Since we don’t commit other stuff to master manually, that works for now.

1 Like