MCPcopy Index your code
hub / github.com/cli/cli / resolveDefaultBranch

Function resolveDefaultBranch

internal/skills/discovery/discovery.go:347–360  ·  view source on GitHub ↗
(client *api.Client, host, owner, repo string)

Source from the content-addressed store, hash-verified

345}
346
347func resolveDefaultBranch(client *api.Client, host, owner, repo string) (*ResolvedRef, error) {
348 apiPath := fmt.Sprintf("repos/%s/%s", url.PathEscape(owner), url.PathEscape(repo))
349 var resp struct {
350 DefaultBranch string `json:"default_branch"`
351 }
352 if err := client.REST(host, "GET", apiPath, nil, &resp); err != nil {
353 return nil, fmt.Errorf("could not determine default branch: %w", err)
354 }
355 branch := resp.DefaultBranch
356 if branch == "" {
357 return nil, fmt.Errorf("could not determine default branch for %s/%s", owner, repo)
358 }
359 return resolveBranchRef(client, host, owner, repo, branch)
360}
361
362// skillMatch represents a matched SKILL.md file and its convention.
363type skillMatch struct {

Callers 1

ResolveRefFunction · 0.85

Calls 3

resolveBranchRefFunction · 0.85
RESTMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected