( owner: string, repo: string, headers: Record<string, string> )
| 174 | } |
| 175 | |
| 176 | async function fetchDefaultBranch( |
| 177 | owner: string, |
| 178 | repo: string, |
| 179 | headers: Record<string, string> |
| 180 | ): Promise<{ branch: string } | { error: string; status: number }> { |
| 181 | const response = await fetch(`${GITHUB_API}/repos/${owner}/${repo}`, { headers }); |
| 182 | if (!response.ok) return { error: await extractGitHubError(response), status: response.status }; |
| 183 | const data = (await response.json()) as { default_branch: string }; |
| 184 | return { branch: data.default_branch }; |
| 185 | } |
| 186 | |
| 187 | type GitHubSkillsResult = |
| 188 | | { status: "ok"; skills: (Skill & { project: string })[] } |
no test coverage detected