feat(app/action): throw for fine-grained PAT (see #1292)
This commit is contained in:
@@ -171,9 +171,11 @@ function quit(reason) {
|
||||
info("GitHub token", token, {token: true})
|
||||
//A GitHub token should start with "gh" along an additional letter for type
|
||||
//See https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats
|
||||
info("GitHub token format", /^gh[pousr]_/.test(token) ? "correct" : "(old or invalid)")
|
||||
info("GitHub token format", /^github_pat_/.test(token) ? "fine-grained" : /^gh[pousr]_/.test(token) ? "classic" : "legacy or invalid")
|
||||
if (!token)
|
||||
throw new Error("You must provide a valid GitHub personal token to gather your metrics (see https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/documentation/setup/action.md for more informations)")
|
||||
if (/^github_pat_/.test(token))
|
||||
throw new Error("It seems you're trying to use a fine-grained personal access token. These are currently unsupported as GitHub does not support them (yet?) for GraphQL API authentication (see https://docs.github.com/fr/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql for more informations). Use a classic token instead.")
|
||||
conf.settings.token = token
|
||||
const api = {}
|
||||
const resources = {}
|
||||
|
||||
Reference in New Issue
Block a user