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.
fix: support fine-grained tokens in pr-review scope validation #442
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
Uh oh!
There was an error while loading. Please reload this page.
fix: support fine-grained tokens in pr-review scope validation #442
Changes from all commits
e10907d6d83d24File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For runs using the newly recommended fine-grained PAT, this loop still looks for
contentsandpull_requestsin theToken scopes:line fromgh auth status. GitHub distinguishes fine-grained PAT permissions from classic PAT OAuth scopes, andgh auth statussurfaces OAuth scopes from the token headers, so a valid fine-grained token with Contents read and Pull requests write can still have no literalcontents/pull_requestsscopes and fail here before any review starts. Probe the required endpoints/permissions instead, or only scope-check classic PATs.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the agent is configured to rebase branches that are behind their base branch, it requires write access to the repository contents. Using contents:read will cause the rebase push to fail. Please update this permission to contents:write (read file contents, diffs, and push rebase commits).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the agent rebases branches when they are behind the base branch, it requires write access to the repository contents. contents:read is insufficient for pushing the rebased commits back to the branch. Please update this permission to contents:write (read files/diffs and push rebase commits).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When someone follows the new recommended fine-grained PAT setup, approvals can be posted but auto-merge will not be enabled because
scripts/post-pr-review.shlater runsgh pr merge "$PR_URL" --auto --squash, and GitHub requires the fine-grained token to have Contents write for PR merges. With onlycontents:read, that command is swallowed by|| true, so the log can still say the review was posted and auto-merge enabled while the approved PR remains unmerged.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For mention-triggered reviews, this now tells operators to put the same fine-grained PAT into
petry-projects/.github, but that recommended token only hascontents:read. The mention listener dispatches to.github-privateviaPOST /repos/.../dispatches, and GitHub documents that creating a repository dispatch event with a fine-grained token requires Contents write, so@donpetry-botmentions configured this way will acknowledge/resolve the PR but fail to start the review run.Useful? React with 👍 / 👎.