Announcing Boolean Operators in Conditions
Over the years, Mergify users wish they could be more expressive in the way they write their pull request rules. As those rules are a combination of conditions, being able to use or
and and
operators inside those expressions is a must-have.
We are pleased to announce that this long-awaited feature is now generally available.
Combining Conditions
Without those operators, many of the constraints are difficult to express with Mergify pull request rules conditions. If you wanted to apply an action for only a couple of author
, you had to duplicate your rule and write something along the line:
pull_request_rules:
- name: Queue for merge pull request for alice
conditions:
- author=alice
actions:
queue:
- name: Queue for merge pull request for bob
conditions:
- author=bob
actions:
queue:
This ruleset works fine, but is verbose and duplicates a single rule. It's a little cumbersome to manage.
With the new or
operator, it becomes easy to merge the two rules into a single one:
pull_request_rules:
- name: Queue for merge pull request for alice or bob
conditions:
- or:
- author=bob
- author=alice
actions:
queue:
You can combine multiple operators, and nest them up to 3 levels.
pull_request_rules:
- name: Queue for merge pull request for alice or bob or sam if urgent
conditions:
- or:
- author=bob
- author=alice
- and:
- author=sam
- label=urgent
actions:
queue:
Combining works on any conditions and allows you to fully express the rule as you wish.
With this feature being generally available, we hope that every user will now be able to express their rules in a simple and more maintainable manner.