( app: GithubAppMetadata, orgOrRepo: Org | Repo = context.repo, )
| 37 | |
| 38 | /** Type guard to determine if a target is an Org. */ |
| 39 | export 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. */ |
| 44 | export 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 | */ |
| 62 | export async function getAuthTokenFor( |
| 63 | app: GithubAppMetadata, |
| 64 | org: Org, |
no test coverage detected