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

Function FetchRepoVisibility

internal/skills/discovery/discovery.go:192–204  ·  view source on GitHub ↗

FetchRepoVisibility returns the repository visibility: "public", "private", or "internal".

(client *api.Client, host, owner, repo string)

Source from the content-addressed store, hash-verified

190
191// FetchRepoVisibility returns the repository visibility: "public", "private", or "internal".
192func FetchRepoVisibility(client *api.Client, host, owner, repo string) (RepoVisibility, error) {
193 apiPath, err := safeurl.JoinPath("repos", owner, repo)
194 if err != nil {
195 return "", err
196 }
197 var resp struct {
198 Visibility string `json:"visibility"`
199 }
200 if err := client.REST(host, "GET", apiPath.String(), nil, &resp); err != nil {
201 return "", err
202 }
203 return parseRepoVisibility(resp.Visibility)
204}
205
206// ResolveRef determines the git ref to use for a given owner/repo.
207// Priority: explicit version > latest release tag > default branch.

Callers 3

installRunFunction · 0.92
previewRunFunction · 0.92
TestFetchRepoVisibilityFunction · 0.85

Calls 4

JoinPathFunction · 0.92
parseRepoVisibilityFunction · 0.85
RESTMethod · 0.65
StringMethod · 0.65

Tested by 1

TestFetchRepoVisibilityFunction · 0.68