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

Function FetchRepoVisibility

internal/skills/discovery/discovery.go:191–203  ·  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

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