(githubProvider: Github)
| 9 | import type { z } from "zod"; |
| 10 | |
| 11 | export const authGithub = (githubProvider: Github): Octokit => { |
| 12 | if (!haveGithubRequirements(githubProvider)) { |
| 13 | throw new TRPCError({ |
| 14 | code: "NOT_FOUND", |
| 15 | message: "Github Account not configured correctly", |
| 16 | }); |
| 17 | } |
| 18 | |
| 19 | const octokit: Octokit = new Octokit({ |
| 20 | authStrategy: createAppAuth, |
| 21 | auth: { |
| 22 | appId: githubProvider?.githubAppId || 0, |
| 23 | privateKey: githubProvider?.githubPrivateKey || "", |
| 24 | installationId: githubProvider?.githubInstallationId, |
| 25 | }, |
| 26 | }); |
| 27 | |
| 28 | return octokit; |
| 29 | }; |
| 30 | |
| 31 | export const getGithubToken = async ( |
| 32 | octokit: ReturnType<typeof authGithub>, |
no test coverage detected