actions / github-script

Write workflows scripting the GitHub API in JavaScript
MIT License
4.17k stars 416 forks source link

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

Open uccmen opened 1 year ago

uccmen commented 1 year ago

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:

permissions: pull-requests: write

jobs: assign: runs-on: ubuntu-latest steps:

Expected behavior

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.

sregmi-brex commented 1 year ago

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

dudicoco commented 3 months ago

For anyone who has run into this issue, it is fixed by enabling Require review from Code Owners in branch protection settings.

This seems like either a bug or misleading docs.