I’ve been trying to get Herald to trigger when someone commits to a specific branch. The situation is we work on named feature branches and when complete merge to dev
. We want all dev
commits to build, they may or may not be merge commits.
What we are trying to do is trigger a herald rule if “Branch” “is only” dev
OR “Commit” "is merged into branch dev
. i.e. branch contains dev
AND “is merge commit” is insufficient.
I thought I could accomplish this with “contains” or a regular expression. Regular expressions give a little more control but I still haven’t managed to get it to work.
I’ve tried the following:
“Branch” “contains” dev
This results in triggering for all commits and merges relating to dev
, even if the head is a feature branch. So it became apparent that contains wasn’t useful.
“Branch” “matches regexp” ^dev$
This fails the needed test cases using the test console:
With Field: Branches TXX-feature-x TYY-feature-y dev
Passed Branches matches regexp /^dev$/
Passed Rule passed.
Which is unexpected, when using regex101.com with this test string it only matches if the whole string is dev
but Phabricator is matching with additional strings
I also tried other expressions such as (^|[^\s])dev
with no luck. It seems to me that the each branch involved is evaluated separately rather than the whole field at once. Is this correct?
To me, it makes sense that a rule such as “Merge into branch”, “Target is branch” or something similar.
Is there something that I’m missing in understanding these Herald rules or is this just functionality that is not easily accomplished?
Cheers