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
  • 6,818
  • 9
  • 52
  • 103
Andrey RF
  • 342
  • 3
  • 13

1 Answers1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    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 :) – Andrey RF Apr 19 '20 at 19:56
  • 1
    @AndreyRF I agree, that was a workaround indeed. Your solution is safer, even if it involves more hooks. – VonC Apr 19 '20 at 20:06