This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Check config of GH PR service and test appropriately for status/comment ability #50
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.
Based on the configuration of the GH PR service, the "test" will check the permissions of the token to comment or post a status.
I attempted to use the same "no-op" API call style check for comments, but it didn't work in the same way: the API returns a 404 in both the case that the token has insufficient scope as well as the case the the case that the PR number doesn't exist (PR #0 is what I attempted to use, other PRs may not exist yet).
The alternative solution -- checking the headers for x-oauth-scopes -- is pretty good. However, I'm also not certain that it's a definitive solution: I believe there's at least one scenario -- a "machine user" with read-only repo access -- where you can have the proper header (with "repo" scope) but still not be able to post a comment.
/cc @brynary