3

How can I set two or more branches to trigger the hook? enter image description here

For example: I have three branches: master; develop and fix. I want the hook to work for master and develop.

alex
7,59612 gold badges62 silver badges116 bronze badges
asked Apr 19, 2020 at 18:32

1 Answer 1

2

gitlab-org/gitlab-foss issue 20338 which introduced "filter push events by branch" in GitLab 11.3 (Sept. 2018) includes:

support for branch patterns with wildcards (*), like we do with protected branches.

So the pattern itself is fairly limited:

| Wildcard Protected Branch | Matching Branches |
|===========================|==================================================|
| *-stable | production-stable, staging-stable |
| production/* | production/app-server, production/load-balancer |
| *gitlab* | gitlab, gitlab/staging, master/gitlab/production |

There is no xxx|yyy or syntax.

In your case, the pattern *e* would be enough to select only master and develop, not fix.

answered Apr 19, 2020 at 18:52
Sign up to request clarification or add additional context in comments.

2 Comments

I don't think so, bcs if I create a branch with e letter, it will trigger hook too. But I can add one hook to master branch and second hook to develop branch :)
@AndreyRF I agree, that was a workaround indeed. Your solution is safer, even if it involves more hooks.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.