( input: z.infer<typeof apiFindGithubBranches>, )
| 198 | }; |
| 199 | |
| 200 | export const getGithubBranches = async ( |
| 201 | input: z.infer<typeof apiFindGithubBranches>, |
| 202 | ) => { |
| 203 | if (!input.githubId) { |
| 204 | return []; |
| 205 | } |
| 206 | const githubProvider = await findGithubById(input.githubId); |
| 207 | |
| 208 | const octokit = new Octokit({ |
| 209 | authStrategy: createAppAuth, |
| 210 | auth: { |
| 211 | appId: githubProvider.githubAppId, |
| 212 | privateKey: githubProvider.githubPrivateKey, |
| 213 | installationId: githubProvider.githubInstallationId, |
| 214 | }, |
| 215 | }); |
| 216 | |
| 217 | const branches = (await octokit.paginate(octokit.rest.repos.listBranches, { |
| 218 | owner: input.owner, |
| 219 | repo: input.repo, |
| 220 | })) as unknown as Awaited< |
| 221 | ReturnType<typeof octokit.rest.repos.listBranches> |
| 222 | >["data"]; |
| 223 | |
| 224 | return branches; |
| 225 | }; |
no test coverage detected