github.com/nektos/act@v0.2.63/pkg/runner/testdata/actions/node16/node_modules/@octokit/auth-token/dist-src/auth.js (about) 1 const REGEX_IS_INSTALLATION_LEGACY = /^v1\./; 2 const REGEX_IS_INSTALLATION = /^ghs_/; 3 const REGEX_IS_USER_TO_SERVER = /^ghu_/; 4 export async function auth(token) { 5 const isApp = token.split(/\./).length === 3; 6 const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || 7 REGEX_IS_INSTALLATION.test(token); 8 const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token); 9 const tokenType = isApp 10 ? "app" 11 : isInstallation 12 ? "installation" 13 : isUserToServer 14 ? "user-to-server" 15 : "oauth"; 16 return { 17 type: "token", 18 token: token, 19 tokenType, 20 }; 21 }