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

Requesting team as reviewer doesn't respect auto assignment upon PR creation #308

Open
uccmen opened this issue Oct 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@uccmen
Copy link

uccmen commented Oct 28, 2022

Describe the bug
My team has auto-assignment enabled. However, when requesting team as reviewer in a workflow step, it doesn't behave as documented.

When you enable auto assignment, any time your team has been requested to review a pull request, the team is removed as a reviewer and a specified subset of team members are assigned in the team's place.

github.rest.pulls.requestReviewers({
    owner: context.repo.owner,
    repo: context.repo.repo,
    pull_number: context.payload.pull_request.number,
    team_reviewers: ["awesomeTeamSlug"]
});

To Reproduce
Steps to reproduce the behavior:

  1. Enable auto-assignment with Round Robin strategy for your team on Github
  2. Create a workflow file that requests your team as reviewer when a PR is created in a repo
name: Sample workflow

on:
  pull_request:
    types:
      - opened
      - reopened

permissions:
  pull-requests: write

jobs:
  assign:
    runs-on: ubuntu-latest
    steps:
      - name: Set team as reviewer
        uses: actions/github-script@v6
        with:
          github-token: ${{inputs.custom-github-token}} # need a PAT to add team as reviewer
          script: |
            github.rest.pulls.requestReviewers({
              owner: context.repo.owner,
              repo: context.repo.repo,
              pull_number: context.payload.pull_request.number,
              team_reviewers: ["awesomeTeamSlug"]
            });
  1. Make any change and open a PR
  2. Observe that the team as an entity is assigned to the PR instead of a specified subset of team member.

Expected behavior

  • "the team is removed as a reviewer and a specified subset of team members are assigned in the team's place"

Additional context
This bug/odd behavior seems to only occur when PR is initially created. If I configure the workflow to run upon PR reopened, it works as expected.

@joshmgross joshmgross added the bug Something isn't working label Jan 21, 2023
@sregmi-brex
Copy link

We've been running into this issue as well, has a fix been found?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants