policy-bot
policy-bot copied to clipboard
Getting separate emails from both when both team and I got added as reviewers
Policy Boy is sending two emails to me when both team and I got added as reviewers. Is there any way to turn off duplicate emails?
As I mentioned in #313, email notifications are ultimately controlled by GitHub. Because these are two distinct review requests, I can see why they send two emails.
Could you share the policy definition you are using? I think this can only happen if there are at least 2 required rules, they both request reviews, and one requests a team and one requests a user. It might be possible to avoid this by adjusting your policy so that only one rule requests reviewers at a time, or both rules use the same request mode (teams or users).
Can the bot be made to check to see whether individual users being requested reviews from are also members of any teams that are also getting requested for review, and if so, do not request reviews - irrespective of how the rules are set up? This should be doable because I'm sure github APIs allow you to determine team membership rather easily.
Here is policy file for reference
policy:
approval:
- two approvals from teamabc
- one approval from teamxyz
approval_rules:
- name: two approvals from teamabc
requires:
count: 2
teams:
- "myorg/teamabc"
options:
invalidate_on_push: false
ignore_update_merges: true
allow_contributor: true
request_review:
enabled: true
mode: teams
- name: one approval from teamxyz
requires:
count: 1
teams:
- "myorg/teamxyz"
options:
invalidate_on_push: false
ignore_update_merges: true
allow_contributor: true
request_review:
enabled: true