MCPcopy
hub / github.com/upstash/context7 / fetchDefaultBranch

Function fetchDefaultBranch

packages/cli/src/utils/github.ts:176–185  ·  view source on GitHub ↗
(
  owner: string,
  repo: string,
  headers: Record<string, string>
)

Source from the content-addressed store, hash-verified

174}
175
176async 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
187type GitHubSkillsResult =
188 | { status: "ok"; skills: (Skill & { project: string })[] }

Callers 1

listSkillsFromGitHubFunction · 0.85

Calls 1

extractGitHubErrorFunction · 0.85

Tested by

no test coverage detected