(client *api.Client, host, owner, repo string)
| 364 | } |
| 365 | |
| 366 | func 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. |
| 385 | type skillMatch struct { |
no test coverage detected