Skip to content

gh pr edit --add-reviewer Don't acquire organizational teams if it's not necessary #4844

Description

@wzshiming

Describe the feature or problem you’d like to solve

In Github Action

$ gh pr edit --add-reviewer [login]
error fetching organization teams: Resource not accessible by integration

The Github Action TOKEN does not provide this permission
Don't acquire organizational teams if it's not necessary

Proposed solution

Better integration with Github Actions

Additional context

Activity

  1. added
    bugSomething isn't working
    priority-3Affects a small number of users or is largely cosmetic
    and removed
    enhancementa request to improve CLI
    on Dec 3, 2021
  2. mislav commented on Dec 3, 2021

    @mislav
    Contributor

    Thanks for reporting!

    This one is tricky. I generally agree that it doesn't make sense for an --add-reviewer <user> operation to require reading org teams, but right now we preload all review requests for the PR, including teams. Then, we replace values based on the final product after applying all --add-reviewer and --remove-reviewer values:

    cli/pkg/cmd/pr/edit/edit.go

    Lines 231 to 239 in 7e7735d

    union := githubv4.Boolean(false)
    reviewsRequestParams := githubv4.RequestReviewsInput{
    PullRequestID: id,
    Union: &union,
    UserIDs: ghIds(userIds),
    TeamIDs: ghIds(teamIds),
    }
    client := api.NewClientFromHTTP(httpClient)
    return api.UpdatePullRequestReviews(client, repo, reviewsRequestParams)

    To fix this, we would have to stop preloading all previous reviewers when only --add-reviewer was used and use the union: true parameter when adding new reviewers to preserve previous review requests that may exist. Fixing this would also fix a race condition similar to #4835

  3. changed the title [-]`gh issue pr edit --add-reviewer` Don't acquire organizational teams if it's not necessary[/-] [+]`gh pr edit --add-reviewer` Don't acquire organizational teams if it's not necessary[/+] on Dec 3, 2021
  4. wzshiming commented on Dec 22, 2021

    @wzshiming
    Author

    @mislav Hi
    I would like to know when this Bug will be fixed. the /cc of my gh-ci-bot that relies on gh this ability

  5. mislav commented on Dec 22, 2021

    @mislav
    Contributor

    @wzshiming It's being worked on (see linked PR) and most likely fixed in the next release.

  6. wzshiming commented on Dec 22, 2021

    @wzshiming
    Author

    Understand thank you

  7. wzshiming commented on Mar 9, 2022

    @wzshiming
    Author

    @mislav Any update?

  8. mislav commented on Mar 9, 2022

    @mislav
    Contributor

    No, I was a bit stuck on the query aspect of the PR that's linked to this issue, but I plan to get back to it and finish the fix so that this can ship with the next release.

  9. wzshiming commented on Jun 15, 2022

    @wzshiming
    Author

    hi, @mislav any update?

  10. 22 remaining items

  11. added
    coreThis issue is not accepting PRs from outside contributors
    and removed on Jul 28, 2025
  12. BagToad commented on Sep 25, 2025

    @BagToad
    Member

    Related to: #11360

  13. self-assigned this
    on Sep 25, 2025
  14. added a commit that references this issue on Aug 6, 2026
  15. added a commit that references this issue on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsgh-prrelating to the gh pr commandpriority-3Affects a small number of users or is largely cosmetic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions