Files
codeql-action/node_modules/@octokit/auth-token/dist-src/auth.js
Angela P Wen 2e7a05cddb Bump octokit/plugin-retry to v7.1.4
So that `octokit/request-error` can be bumped.
2025-02-25 14:55:06 -08:00

16 lines
421 B
JavaScript

import { isJWT } from "./is-jwt.js";
async function auth(token) {
const isApp = isJWT(token);
const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
const isUserToServer = token.startsWith("ghu_");
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
return {
type: "token",
token,
tokenType
};
}
export {
auth
};