Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple teams and requires.count > 2 produces unintuitive result #496

Open
aw185176 opened this issue Nov 9, 2022 · 1 comment
Open

Comments

@aw185176
Copy link

aw185176 commented Nov 9, 2022

A rule like

- name: rule/1
  if:
    changed_files:
      paths:
      - .*
  requires:
    count: 2
    teams:
    - team/1
    - team/2

Will require at least one review from each team. Based on the README, we were under the impression this would define a rule where 2 reviews from any combo of those teams (2 team/2, 2 team/1, 1 team/1 1 team/2) would satisfy the predicate

@bluekeyes
Copy link
Member

Thanks for reporting this. Can you share any more details about the PR where you saw this behavior? It will be helpful to know who opened or contributed to the PR, who approved it, which teams they belonged to, and what Policy Bot reported as the status for the rule.

I ran a quick test with the latest version of Policy Bot, and this rule behaved as you expected and as the docs imply. I was able to approve my PR with two approvals from members of team/1, two approvals from members of team/2, or one approval from a member of team/1 and one approval from a member of team/2.

Some other factors that might influence the behavior:

  • The count property sets the number of unique users who must approve the rule. If userA is a member of both team/1 and team/2, their approval will only count once for this rule.
  • By default, Policy Bot does not count approvals from the PR author or contributors. You can use the allow_author, allow_contributor, and allow_non_author_contributor options to change this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants