FetchRepoVisibility returns the repository visibility: "public", "private", or "internal".
(client *api.Client, host, owner, repo string)
| 190 | |
| 191 | // FetchRepoVisibility returns the repository visibility: "public", "private", or "internal". |
| 192 | func 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. |