nix-community.nixvim/.github/mergify.yml
Matt Sturgeon 4697b96a01
mergify: fix "update PR" logic
We can no longer simply check the files list matches `[ flake.lock ]`,
since we now also touch `generated/` files.

Mergify conditions cannot be checked against "all" list items; checks
are always applied against "any" item. Therefore we need some
double-negatives to check that "any item does not match a regex that
does not match (flake.lock|generated/.*)".

Yes, this is horrible.
2024-09-12 10:31:45 +01:00

31 lines
1.4 KiB
YAML

# Essential reading on condition syntax:
# https://docs.mergify.com/configuration/conditions/#testing-and-debugging-conditions
# https://docs.mergify.com/merge-queue
queue_rules:
- name: default
# Account used for pushing rebased updates. Default is {{author}},
# but that doesn't work when they haven't logged into Mergify Dashboard:
# https://github.com/Mergifyio/mergify/issues/5075
update_bot_account: nix-infra-bot
update_method: rebase
merge_method: fast-forward
merge_conditions:
- check-success = buildbot/nix-eval
queue_conditions:
- or:
# Allow queuing PRs that have been approved
- "#approved-reviews-by >= 1"
# Allow queuing update PRs without approval
- and:
# We need a double-negative, because mergify only has "any" conditions on list types...
#
# So we check if "any file does not match the regex", using the `-` prefix operator.
# The regex matches anything except `flake.lock` and `generated`, using a negative lookahead `(?!)`
#
# After canceling out the double-negative, the condition below is true when
# _all_ files match either `^flake\.lock$` or `^generated/`
- "-files ~= ^(?!flake[.]lock$|generated/)"
# Also check the PR was opened by the github-actions bot
- author = github-actions