create-pull-request: `team-reviewers` option doesn't work anymore

Subject of the issue

Since 5 days ago the option to request a review from any of the owners, or later, the members of a team doesn’t work anymore with the following error:

Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the company-name/repository-name repository.

Steps to reproduce

Create a PR with:

      - name: Create PR
        id: create-pr
        if: ${{ steps.prepare-pr.outputs.create_pr == 'True' }}
        uses: peter-evans/create-pull-request@v4
        with:
          path: reponame-repo
          add-paths: node/${{ inputs.hostname }}
          token: ${{ env.GITHUB_REPO_TOKEN }}
          branch: EOL_${{ inputs.hostname }}
          commit-message: Remove ${{ inputs.hostname }}
          title: Remove ${{ inputs.hostname }}
          body: ${{ env.pull_request_body }}
          assignees: ${{ github.actor }}
          team-reviewers: owners
          labels: Prepare for removal
          draft: ${{ steps.prepare-pr.outputs.remnants_warning }}

Later, I tried with the same as above, but:

          team-reviewers: company-name/team-name

But that failed with same error. I also tried other things like team-reviewers: team-name and:

          team-reviewers: |
            company-name/team-name

All of them failed.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 8
  • Comments: 28 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve made a couple of changes that I’ve released in v5.0.0 / v5.

  • Improved the handling of error Validation Failed: "Could not resolve to a node with the global id of 'xxxxxxxxxxxxx'." to provide a clearer reason for the failure.
  • Strip the leading <org>/ from teams if supplied.

@harpener You are getting that error because you are using the default GITHUB_TOKEN. I’m not sure if the default token worked for requesting reviews from teams before, but it definitely does not work anymore since GitHub’s update. And I’m fairly sure that is the correct behaviour. The token must have at least repo scope to be able to request a review. If it was working before without that then I believe it was a mistake which has now been corrected.

Summary:

  • Specify the teams as team slugs without the leading <org>/, as I described here.
  • Use a PAT with repo scope.

If you don’t specify the teams correctly without the leading <org>/, then you will see the following error:

Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the org/repo repository.

If you don’t use a PAT with repo scope then you will see the following error:

Validation Failed: "Could not resolve to a node with the global id of 'xxxxxxxxxxxxx'."

@peter-evans I should mention that in my case the team is not secret, but visible to everyone in our organization. Only the repository is private to the outside world.

I’ve opened a GitHub support case because something is clearly wrong with the API and it seems difficult to reproduce and debug.

In the meantime, I’ll look into using the GraphQL API to request team reviewers, since that appears to work.

Perhaps this is the cause. Did GitHub stop allowing requesting team reviewers for private repositories under the GitHub Free billing plans recently?

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review

image

I can’t find any public announcement about this if they did change it recently.

Thanks @harpener, I misunderstood the conditions under which this was occurring. I’ve got it now so I’ll test some more.

@peter-evans you can find the code here and the logs here

I’ve tried multiple PAT’s, including my own which is an admin for our org and works with the gh cli. I created a new PAT with no luck