Update index.mjs

This commit is contained in:
Simon Lecoq
2021-04-11 22:58:30 +02:00
parent 432d721577
commit ecf8913701

View File

@@ -104,7 +104,7 @@
info("Use mocked API", true)
}
//Test token validity
else if (!/^(?:MOCKED_TOKEN|NOT_NEEDED)$/.test(token)) {
else if (!/^NOT_NEEDED$/.test(token)) {
const {headers} = await api.rest.request("HEAD /")
if (!("x-oauth-scopes" in headers))
throw new Error("GitHub API did not send any \"x-oauth-scopes\" header back from provided \"token\". It means that your token may not be valid or you're using GITHUB_TOKEN which cannot be used since metrics will fetch data outside of this repository scope. Use a personal access token instead (see https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/setup/action/setup.md for more informations).")