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

Unable to use github team #106

Open
litepl opened this issue Jun 27, 2023 · 5 comments
Open

Unable to use github team #106

litepl opened this issue Jun 27, 2023 · 5 comments

Comments

@litepl
Copy link

litepl commented Jun 27, 2023

Hello,

I just don't know what I'm doing wrong...

workflow

name: Add default reviewers
run-name: Add default reviewers
on:
  pull_request:
    types: [opened, ready_for_review, reopened]
jobs:
  add-default-reviewers:
    runs-on: self-hosted
    steps:
      - name: Auto Request Review
        uses: necojackarc/[email protected]
        with:
          token: ${{ secrets.PAT_FOR_AUTO_REQUEST_REVIEW }}
          config: .github/reviewers.yaml

reviewers.yaml

reviewers:
  defaults:
    - team:devops
options:
  ignore_draft: true

PAT_FOR_AUTO_REQUEST_REVIEW has full access to all repos

The funny thing is, when I remove devops team from collaborators the job succeed but no reviewers are added. When I'm adding it with admin role, the error is:

Error: HttpError: Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the HardRockDigital/lt-test repository.
@jbergstroem
Copy link

Were you able to figure this out? I'm seeing the same. I invited the team to the repo and tested both read, triage roles.

@litepl
Copy link
Author

litepl commented Aug 28, 2023

Were you able to figure this out? I'm seeing the same. I invited the team to the repo and tested both read, triage roles.

Nope. I had to focus on other things but I'm going to go back to this topic soon;

@necojackarc
Copy link
Owner

@litepl

The funny thing is, when I remove devops team from collaborators the job succeed but no reviewers are added. When I'm adding it with admin role, the error is:

Error: HttpError: Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the HardRockDigital/lt-test repository.

It may suggest that the action tries to request reviews but it fails. Do you have any more log or error messages when you tried it with the devops team in your collaborators?

By the way, were you able to request a review for that team manually?

@chrockhill12
Copy link

chrockhill12 commented May 22, 2024

@necojackarc -- I am having this same issue

When the team has access to the repo I get

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

When I remove the team access to the repo I get:

Error: HttpError: Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the mds-emu/release-eng-test repository.

@jonpitch
Copy link

jonpitch commented Aug 9, 2024

just in case anyone else runs in to this, i think the issue (at least for me) was the secrets.GITHUB_TOKEN is only scoped to the repository, and isn't able to read teams/members from the organization. my workaround for this was to create a fine-grained personal access token, with the organization as the resource owner, and give the token permissions to read teams/members, read/write pull requests, etc. you can then make this token available as an organization secret, or per repository.

the downside (aside from managing this token), is that any assignment that isn't team based will show up on the PR as coming from the user who created the token, not the organization. it's not a big deal for me, but you could create a generic user in the organization who owns the token if you wanted.

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

5 participants