0

We create new branches from develop branch that starts with hotfix/bla_bla or feature/bla_bla. Then, we merge them back into develop branch. On merge requests, I would like to run a job only when we merge feature branches into develop branch. Something like:

job:
stage: test
only:
 refs:
 - develop && "when a branch which starts with 'feature/' is merged into develop"

How could I achieve this in .gitlab-ci.yml file or using a .sh file?

1 Answer 1

2

Untested, but you potentially can use a combination of pipelines for merge requests and the CI Variable CI_MERGE_REQUEST_SOURCE_BRANCH_NAME.

For example, something like:

job:
  stage: test
  only:
   refs:
     - merge_requests
     - develop
   variables:
     - $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "feature/*"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.