-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Cannot use fine-grained PATs to add labels to pull requests #9166
Comments
Hey @jamiesanson, can you share the output of |
Sure! Here's the output using
|
Note, I've also been able to reproduce the same issue with other |
Yeh so we can see here that when we're looking for the PR using the Can you try giving |
Note: We've seen this working using a Classic Token with the Project read scope, so feels like an issue with fine-grained PATs and project access. The scopes we used were:
|
Another note: We've also had this working with permissions:
# write: gh pr edit
pull-requests: write
# gh pr edit (workaround for this issue)
repository-projects: read |
Hmmm looks like something similar was reported in March but wasn't triaged: #8784 and also on the community forums: https://github.com/orgs/community/discussions/111324 It may well be that fine-grained PATs don't support this. It wouldn't be the first time that things haven't been fully implemented. I'll see what I can find internally, thanks for your continued investigation. |
In the meantime I wonder whether we could be smarter about what we try to fetch. Like, is it really necessary for us to fetch Also loosely related: #6274 |
Yeah, we've had similar conversations internally. Based on what we've read in the code & documentation, |
Projects (classic) can be owned by the org or by the repository. Naively, when I see code like the above or in programmatic_access.yaml, it makes me wonder if we somehow missed adding project permissions to the Repository scope ( - namespace: Api::Projects
endpoint: GET /projects/columns/:column_id/cards
service: projects
access_definition: show_project
server_to_server:
enabled: true
user_to_server:
enabled: true
allows_public_read: true
permission_sets:
- repository_projects: read
- organization_projects: read |
This would definitely be helpful for us, we do not use projects and it would be ideal to not have to grant an extraneous permission. |
also experiencing this with |
Describe the bug
Using certain
gh pr
commands never works with a fine-grained PAT asGH_TOKEN
, regardless of scopes granted to it.CLI version:
Steps to reproduce the behavior
gh
(GH_TOKEN
)gh pr view 201
See: Fine-grained PAT permissions
Expected vs actual behavior
Expected: PR can be viewed successfully.
Actual: Error:
GraphQL: Resource not accessible by personal access token (repository.pullRequest.projectCards.nodes)
The text was updated successfully, but these errors were encountered: