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

Function getAuthTokenFor

github-actions/utils.ts:39–61  ·  view source on GitHub ↗
(
  app: GithubAppMetadata,
  orgOrRepo: Org | Repo = context.repo,
)

Source from the content-addressed store, hash-verified

37
38/** Type guard to determine if a target is an Org. */
39export function isOrg(target: unknown): target is Org {
40 return typeof target === 'object' && target !== null && typeof (target as Org).org === 'string';
41}
42
43/** Type guard to determine if a target is a Repo. */
44export function isRepo(target: unknown): target is Repo {
45 return (
46 typeof target === 'object' &&
47 target !== null &&
48 typeof (target as Repo).repo === 'string' &&
49 typeof (target as Repo).owner === 'string'
50 );
51}
52
53/**
54 * Retrieves an installation auth token for the provided app.
55 *
56 * Using our own robot account is preferable as it makes it immediately apparent in context of an
57 * issue/pr event that this was performed by the Angular team. Additionally, this allows for us to
58 * have another layer of ability to manage access as the Angular app needs to obtain permission to
59 * act on a repository, unlike the github-actions robot account which implicitly has access based on
60 * where it was executed from.
61 */
62export async function getAuthTokenFor(
63 app: GithubAppMetadata,
64 org: Org,

Callers 8

mainFunction · 0.85
mainFunction · 0.85
runFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
githubFunction · 0.85

Calls 1

getJwtAuthedAppClientFunction · 0.85

Tested by

no test coverage detected