fix: clarify scope error while creating issues for projects#12596
Open
elijahthis wants to merge 3 commits intocli:trunkfrom
Open
fix: clarify scope error while creating issues for projects#12596elijahthis wants to merge 3 commits intocli:trunkfrom
elijahthis wants to merge 3 commits intocli:trunkfrom
Conversation
3 tasks
Member
|
Hey @elijahthis, thank you for the PR. It looks like there are some issues with the tests. Could you have a look at those and @ mention me when it's ready for review? 🙏 |
Author
On it! |
Author
|
Hii @BagToad seems GitHub Actions was down when I pushed the last time. Just pushed an empty commit and checks all pass. Ready for review ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced GraphQL error handling to provide more user-friendly and actionable messages when a token lacks the necessary permissions. Instead of a verbose technical trace, users now receive a concise list of missing scopes and a direct command to resolve the issue via gh auth refresh.
Changes
Note
I basically replicated the logic being used for queries (

handleErrorfound inpkg/cmd/project/shared/queries/queries.go)Example
Before (Raw GraphQL Trace):
GraphQL: Your token has not been granted the required scopes to execute this query. The 'addProjectV2ItemById' field requires one of the following scopes: ['project'], but your token has only been granted the: ['gist', 'read:org', 'read:project', 'repo', 'workflow'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens.Now (Clean CLI Error):
Test plan
Fixes #12585