gh icon indicating copy to clipboard operation
gh copied to clipboard

Add support for GitHub fine-grained personal access tokens

Open jvstein opened this issue 2 years ago • 2 comments

GitHub just added support for new fine-grained personal access tokens, but the validate_gh_pat function does not validate them properly.

The new tokens appear to match "^github_pat_[A-Za-z0-9_]+$"

✖ The PAT discovered for 'https:/github.com' has the wrong structure.
Error in `validate_gh_pat()`:
! Invalid GitHub PAT format
ℹ A GitHub PAT must have one of two forms:
• 40 hexadecimal digits (older PATs)
• A 'ghp_' prefix followed by 36 to 251 more characters (newer PATs)
ℹ Read more at <https://gh.r-lib.org/articles/managing-personal-access-tokens.html>.

jvstein avatar Oct 19 '22 01:10 jvstein

Thanks! Do you want to submit a PR? (No pressure.)

gaborcsardi avatar Oct 19 '22 06:10 gaborcsardi

Sure! Submitted https://github.com/r-lib/gh/pull/172

jvstein avatar Oct 19 '22 18:10 jvstein