Files
codeql-action/node_modules/@octokit/oauth-app/dist-src/methods/get-user-octokit.js
2025-02-19 11:13:12 -08:00

30 lines
746 B
JavaScript

import { createOAuthUserAuth } from "@octokit/auth-oauth-user";
import { emitEvent } from "../emit-event.js";
async function getUserOctokitWithState(state, options) {
return state.octokit.auth({
type: "oauth-user",
...options,
async factory(options2) {
const octokit = new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: options2
});
const authentication = await octokit.auth({
type: "get"
});
await emitEvent(state, {
name: "token",
action: "created",
token: authentication.token,
scopes: authentication.scopes,
authentication,
octokit
});
return octokit;
}
});
}
export {
getUserOctokitWithState
};