MCPcopy Create free account
hub / github.com/github/gh-aw / createAuthenticatedGitHubClient

Function createAuthenticatedGitHubClient

actions/setup/js/handler_auth.cjs:40–50  ·  view source on GitHub ↗

* Creates an authenticated GitHub client from the handler configuration. * * If the handler config contains a "github-token" field, this function creates * a new Octokit instance authenticated with that token. This enables cross-repository * operations where a PAT with access to the target repo

(config)

Source from the content-addressed store, hash-verified

38 * Both return values expose the same API surface (rest, graphql, etc.).
39 */
40async function createAuthenticatedGitHubClient(config) {
41 // Note: bracket notation is required because "github-token" contains a hyphen
42 // (not a valid JavaScript identifier). This is consistent with other hyphenated
43 // config keys like "target-repo" and "allowed-repos".
44 const token = config["github-token"];
45 if (!token) {
46 return github;
47 }
48 core.info("Using per-handler github-token for cross-repository authentication");
49 return global.getOctokit(token);
50}
51
52module.exports = { createAuthenticatedGitHubClient };

Callers 15

mainFunction · 0.85
mainFunction · 0.85
remove_labels.cjsFile · 0.85
mainFunction · 0.85
mainFunction · 0.85
assign_to_user.cjsFile · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
replace_label.cjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected