github-script icon indicating copy to clipboard operation
github-script copied to clipboard

Unable to request team as reviewer with default GITHUB_TOKEN

Open uccmen opened this issue 3 years ago • 0 comments

Description When requesting a team of a Github org as a reviewer using default GITHUB_TOKEN, the action fails with a status code of 422 with the following error:

RequestError [HttpError]: Validation Failed: "Could not resolve to a node with the global id of 'MDQ6VGVhbTQzMjk3NzM='."
    at /home/runner/work/_actions/actions/github-script/v6/dist/index.js:4561:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5

To Reproduce

  1. Create a simple workflow that will trigger on any PR opened
  2. Define a step as follows:
- name: Set team as reviewer
  uses: actions/github-script@v6
  with:
    github-token: ${{secrets.GITHUB_TOKEN}}
    script: |
      github.rest.pulls.requestReviewers({
        owner: context.repo.owner,
        repo: context.repo.repo,
        pull_number: context.payload.pull_request.number,
        team_reviewers: ["awesome_team_slug"] # replace this with any team existing in your Github org
      });
  1. Create any PR with the workflow above included
  2. Wait for the action to run and notice the step to fail

Expected behavior I expect the step to pass

Actual behavior Step failed

Additional context According to this comment, it could be a Github API bug because when the same script is used with a PAT, the step runs successfully and the team is added as a reviewer. I wanted to track a report here because I was using github.rest.pulls.requestReviewers. Please let me know if I should create a bug report elsewhere.

uccmen avatar Aug 19 '22 10:08 uccmen