policy-bot icon indicating copy to clipboard operation
policy-bot copied to clipboard

Getting separate emails from both when both team and I got added as reviewers

Open snallami opened this issue 3 years ago • 3 comments

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?

snallami avatar Jun 23 '21 22:06 snallami

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).

bluekeyes avatar Jun 24 '21 00:06 bluekeyes

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.

vfunshteyn-zw avatar Jun 25 '21 17:06 vfunshteyn-zw

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

snallami avatar Jun 28 '21 22:06 snallami