MCPcopy Create free account
hub / github.com/angular/dev-infra / getAuthenticatedGithubClient

Function getAuthenticatedGithubClient

apps/functions/code-of-conduct/shared.ts:105–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103 }
104 throw err;
105 }
106
107 return context as AuthenticatedCallableContext;
108}
109
110/** Retrieves a Github client instance authenticated as the Angular Robot Github App. */
111export async function getAuthenticatedGithubClient(): Promise<Octokit> {
112 const GITHUB_APP_PEM = Buffer.from(
113 process.env['ANGULAR_ROBOT_APP_PRIVATE_KEY']!,
114 'base64',
115 ).toString('utf-8');
116
117 const applicationGithub = new Octokit({
118 authStrategy: createAppAuth,
119 auth: {appId: process.env['ANGULAR_ROBOT_APP_ID']!, privateKey: GITHUB_APP_PEM},
120 });
121 /** The specific installation id for the provided repository. */
122 const {id: installation_id} = (await applicationGithub.apps.getOrgInstallation({org: 'angular'}))
123 .data;
124 /** A temporary github access token. */
125 const {token} = (
126 await applicationGithub.rest.apps.createInstallationAccessToken({installation_id})
127 ).data;

Callers 4

unblockUser.tsFile · 0.85
blockUser.tsFile · 0.85
syncUsersFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected