initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
21
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
Normal file
21
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/auth.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
const REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
|
||||
const REGEX_IS_INSTALLATION = /^ghs_/;
|
||||
const REGEX_IS_USER_TO_SERVER = /^ghu_/;
|
||||
export async function auth(token) {
|
||||
const isApp = token.split(/\./).length === 3;
|
||||
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) ||
|
||||
REGEX_IS_INSTALLATION.test(token);
|
||||
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
|
||||
const tokenType = isApp
|
||||
? "app"
|
||||
: isInstallation
|
||||
? "installation"
|
||||
: isUserToServer
|
||||
? "user-to-server"
|
||||
: "oauth";
|
||||
return {
|
||||
type: "token",
|
||||
token: token,
|
||||
tokenType,
|
||||
};
|
||||
}
|
||||
6
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
Normal file
6
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/hook.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { withAuthorizationPrefix } from "./with-authorization-prefix";
|
||||
export async function hook(token, request, route, parameters) {
|
||||
const endpoint = request.endpoint.merge(route, parameters);
|
||||
endpoint.headers.authorization = withAuthorizationPrefix(token);
|
||||
return request(endpoint);
|
||||
}
|
||||
14
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
Normal file
14
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { auth } from "./auth";
|
||||
import { hook } from "./hook";
|
||||
export const createTokenAuth = function createTokenAuth(token) {
|
||||
if (!token) {
|
||||
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
|
||||
}
|
||||
if (typeof token !== "string") {
|
||||
throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string");
|
||||
}
|
||||
token = token.replace(/^(token|bearer) +/i, "");
|
||||
return Object.assign(auth.bind(null, token), {
|
||||
hook: hook.bind(null, token),
|
||||
});
|
||||
};
|
||||
1
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/types.js
generated
vendored
Normal file
1
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
11
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
Normal file
11
github/codeql-action-v2/node_modules/@octokit/auth-token/dist-src/with-authorization-prefix.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Prefix token for usage in the Authorization header
|
||||
*
|
||||
* @param token OAuth token or JSON Web Token
|
||||
*/
|
||||
export function withAuthorizationPrefix(token) {
|
||||
if (token.split(/\./).length === 3) {
|
||||
return `bearer ${token}`;
|
||||
}
|
||||
return `token ${token}`;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue