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