rules:
- name: Foo files
check_type: changed_files
condition: ^foo/.*
all_distinct:
- min_approvals: 1
teams:
- foo-team
# The fallback rule matches every file by default and is only attempted if no
# rule is matched for a given file; as it matches every file, it cannot have a
# condition.
fallback-rule:
min_approvals: 2
teams:
- bar-team
Or, more flexibly, allow for a sequence of fallback rules in which the rules are processed in order and stop at the first matched one.
rules:
- name: Foo files
check_type: changed_files
condition: ^foo/.*
all_distinct:
- min_approvals: 1
teams:
- foo-team
# The fallback rules are processed in order and stop at the first match.
# Fallback rules can't have "exclude" since the processing automatically
# falls through to the next one.
fallback-rules:
- name: Bar files
check_type: changed_files
condition: ^bar/.*
min_approvals: 2
teams:
- bar-team
# The last rule can't have a condition since it matches everything by
# default.
- name: Baz files
check_type: changed_files
min_approvals: 2
teams:
- baz-team
Problem: https://github.com/paritytech/polkadot/blob/3dd9741e77e2ff121990208f6ee1e115adb7e5bf/.github/pr-custom-review.yml#L23 is awkward because it means "all files except ones managed by other rules" and this is achieved by manually excluding conditions from other rules; there should be an automatic and simpler way of achieving the same.
Solution: Allow for a
fallback-rule
Or, more flexibly, allow for a sequence of fallback rules in which the rules are processed in order and stop at the first matched one.