MCPcopy Create free account
hub / github.com/cli/cli / resolveDefaultBranch

Function resolveDefaultBranch

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

Source from the content-addressed store, hash-verified

364}
365
366func resolveDefaultBranch(client *api.Client, host, owner, repo string) (*ResolvedRef, error) {
367 apiPath, err := safeurl.JoinPath("repos", owner, repo)
368 if err != nil {
369 return nil, err
370 }
371 var resp struct {
372 DefaultBranch string `json:"default_branch"`
373 }
374 if err := client.REST(host, "GET", apiPath.String(), nil, &resp); err != nil {
375 return nil, fmt.Errorf("could not determine default branch: %w", err)
376 }
377 branch := resp.DefaultBranch
378 if branch == "" {
379 return nil, fmt.Errorf("could not determine default branch for %s/%s", owner, repo)
380 }
381 return resolveBranchRef(client, host, owner, repo, branch)
382}
383
384// skillMatch represents a matched SKILL.md file and its convention.
385type skillMatch struct {

Callers 1

ResolveRefFunction · 0.85

Calls 5

JoinPathFunction · 0.92
resolveBranchRefFunction · 0.85
RESTMethod · 0.65
StringMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected