(owner: string, repo: string)
| 84 | ); |
| 85 | |
| 86 | export const addGithubRepo = async (owner: string, repo: string) => sew(() => |
| 87 | withOptionalAuth(async () => { |
| 88 | const response = await fetch(`${WORKER_API_URL}/api/experimental/add-github-repo`, { |
| 89 | method: 'POST', |
| 90 | body: JSON.stringify({ owner, repo }), |
| 91 | headers: { |
| 92 | 'Content-Type': 'application/json', |
| 93 | }, |
| 94 | }); |
| 95 | |
| 96 | if (!response.ok) { |
| 97 | return unexpectedError('Failed to add GitHub repo'); |
| 98 | } |
| 99 | |
| 100 | const data = await response.json(); |
| 101 | const schema = z.object({ |
| 102 | jobId: z.string(), |
| 103 | repoId: z.number(), |
| 104 | }); |
| 105 | return schema.parse(data); |
| 106 | }) |
| 107 | ); |
no test coverage detected