Rule to make it possible to self-approve for certain users
junwang-wish opened this issue · 1 comments
junwang-wish commented
policy:
approval:
- or:
- FORCE_COMMIT
- auto_approve
- or:
- team_review
- critical_person_review
approval_rules:
- name: FORCE_COMMIT
requires:
count: 1
# only some users are allowed to give this sort of commit
teams: ["team_a"]
options:
allow_author: true
allow_contributor: true
methods:
comments:
- FORCE_COMMIT
# If status checks indicate that change can be auto approved, change doesn't need human review
- name: auto_approve
if:
has_successful_status:
- "auto-approve"
requires:
count: 0
options:
invalidate_on_push: true
- name: team_review
if:
changed_files:
paths:
- ".*"
requires:
count: 1
teams: ["team_a"]
options:
invalidate_on_push: true
methods:
github_review: true
- name: critical_person_review
if:
changed_files:
paths:
- ".*"
requires:
count: 1
users:
- person_b
options:
invalidate_on_push: true
methods:
github_review: true
Is there a way to modify the policy.yaml above so that person_b
can self-approve PR? Or it is fundamentally impossible to let policy-bot allow self-approval for PRs?
bluekeyes commented
Yes, you can enable self-approval by using one or more of these options:
allow_author: true
allow_contributor: true
allow_non_author_contributor: true
See the README for details on the differences between these, but for most cases of self-approval, allow_contributor
is probably the best choice:
- name: critical_person_review
if:
changed_files:
paths:
- ".*"
requires:
count: 1
users:
- person_b
options:
allow_contributor: true
invalidate_on_push: true
methods:
github_review: true