Support GitHub fine-grained PATs.
Review Request #15032 — Created May 8, 2026 and submitted
Until now, we've only supported classic Personal Access Tokens for
authenticating with GitHub. While these aren't going away (yet), we
really ought to support the newer fine-grained tokens.This change adds support for those. This is mostly handled through
documentation and validation--our existing validator needed to be
updated because access with a fine-grained PAT does not return the
x-oauth-scopes header. We therefore attempt to access an endpoint inside
check_repositorywhich requires the necessary permissions in order to
detect this prior to actual usage.While in here, I realized that the scopes we ask for on classic PATs are
excessive. We were asking for "user", "repo", and "admin:repo_hook".
While we do access the/user/API endpoint, this doesn't actually
require the user scope for read. We also don't automatically create
webhooks, we only show some instructions, so the repo_hook scope was
never necessary either.
- Added a fine-grained PAT with the necessary permissions and verified
that GitHub functionality worked as expected. - Verified that a classic PAT still worked as expected.
- Ran unit tests.
- Built the manual and checked the changed pages.
- Tested the remote-repositories API endpoint with both classic PATs
(with only the "repo" scope) and fine-grained PATs (with the
"Metadata" and "Contents" permissions)
| Summary | ID |
|---|---|
| svowmurswprrnynnytupyvrqnmunlyxr |
| Description | From | Last Updated |
|---|---|---|
|
The review request is linked to bug "x" (typo I assume). |
|
|
|
I want to keep admin:repo_hook so I can build out hook management. Better to not have people have to re-create … |
|
|
|
Same here, let's keep admin:repo_hook. |
|
|
|
This gets very long very fast. Maybe we should just point to the docs, and then include a link for … |
|
|
|
This drops all classic access token information. Fine-grained access tokens have real limits. One token cannot be used for both … |
|
|
|
We need the prior roles for existing APIs. |
|
|
|
We should put the gettext on the previous line and )) on its own line so the string has more … |
|
|
|
Doesn't this require the user scope? |
|
|
|
Same here. |
|
|
|
Minor nit: Can we alphabetize these? |
|
|
|
We use "tradeoff" here (from my original copy) but "trade-off" in the new documentation. I think "trade-off" is more common. … |
|
- Testing Done:
-
- Added a fine-grained PAT with the necessary permissions and verified
that GitHub functionality worked as expected.
- Verified that a classic PAT still worked as expected.
- Ran unit tests.
- Built the manual and checked the changed pages.
+ - Tested the remote-repositories API endpoint with both classic PATs
(with only the "repo" scope) and fine-grained PATs (with the
"Metadata" and "Contents" permissions)
- Added a fine-grained PAT with the necessary permissions and verified
- Commits:
-
Summary ID svowmurswprrnynnytupyvrqnmunlyxr svowmurswprrnynnytupyvrqnmunlyxr - Bugs:
-
- Diff:
Revision 2 (+568 -186)
Checks run (2 succeeded)
flake8 passed.JSHint passed.
-
-
I want to keep
admin:repo_hookso I can build out hook management. Better to not have people have to re-create hooks after installing for the first time with this release.Same goes for the other mentions.
-
-
This gets very long very fast. Maybe we should just point to the docs, and then include a link for the template for creating the fine-grained tokens. I feel like we would want a big
<strong>Warning:</strong>about expiration though. -
-
We should put the
gettexton the previous line and))on its own line so the string has more breathing room and is self-contained. -
- Commits:
-
Summary ID svowmurswprrnynnytupyvrqnmunlyxr svowmurswprrnynnytupyvrqnmunlyxr
Checks run (2 succeeded)
-
-
This drops all classic access token information.
Fine-grained access tokens have real limits. One token cannot be used for both public repositories and for an organization's repository. It also cannot be used across multiple organizations. These are documented as limitations on GitHub's pages that haven't yet been addressed. That means a lot more juggling and debugging and expiration management for admins.
I am happy to support fine-grained access tokens. I don't believe that them being the primary method we recommend is going to be a good user experience. Even if they're technically more secure, it's very situational, and the second there's an issue it turns into the same awful debugging session we've seen in the past where people have a linked account with a token someone removed.
I think we should continue to support classic tokens as the primary, and document them, and support fine-grained tokens as the secondary. This mirrors how GitHub's had it for years. Even today, they advertise classic tokens for general API use, and fine-grained tokens for personal API and git-over-HTTPS use.
- Commits:
-
Summary ID svowmurswprrnynnytupyvrqnmunlyxr svowmurswprrnynnytupyvrqnmunlyxr
Checks run (2 succeeded)
- Commits:
-
Summary ID svowmurswprrnynnytupyvrqnmunlyxr svowmurswprrnynnytupyvrqnmunlyxr