palantir / policy-bot

A GitHub App that enforces approval policies on pull requests
Apache License 2.0
766 stars 104 forks source link

How we can exclude bot from approval #847

Open rajesh-dhakad opened 3 weeks ago

rajesh-dhakad commented 3 weeks ago

We have a usecase where the gh-auto-approve bot approves the PR - how can I exclude gh-auto-approve from approval_rules?

Note: gh-auto-approve is part of our org/eng team which we want to keep as it is.

policy:
  approval:
        - the eng team approval

approval_rules:
  - name: the eng team approval
    requires:
      count: 1
      teams:
        - "org/eng"
bluekeyes commented 3 weeks ago

There's currently no support for ignoring approvals from specific users who otherwise meet the conditions specified in the rule. I think your best option will be to create a new team, maybe org/eng-approvers, as a nested team of the org/eng team and then move all of the users except for gh-auto-approve to the child team. Finally, update your policy to use the org/eng-approvers in the approval rule. Using a nested team should mean that you don't have to change anything else that uses the org/eng team.