(client *http.Client, host, orgName string, showSelectedRepoInfo bool)
| 210 | } |
| 211 | |
| 212 | func getOrgVariables(client *http.Client, host, orgName string, showSelectedRepoInfo bool) ([]shared.Variable, error) { |
| 213 | u, err := safeurl.JoinPath("orgs", orgName, "actions", "variables") |
| 214 | if err != nil { |
| 215 | return nil, err |
| 216 | } |
| 217 | variables, err := getVariables(client, host, u) |
| 218 | if err != nil { |
| 219 | return nil, err |
| 220 | } |
| 221 | apiClient := api.NewClientFromHTTP(client) |
| 222 | if showSelectedRepoInfo { |
| 223 | for i := range variables { |
| 224 | if variables[i].SelectedReposURL == "" { |
| 225 | continue |
| 226 | } |
| 227 | count, err := shared.SelectedRepositoryCount(apiClient, host, safeurl.NewImmutableSafeURL(variables[i].SelectedReposURL)) |
| 228 | if err != nil { |
| 229 | return nil, fmt.Errorf("failed determining selected repositories for %s: %w", variables[i].Name, err) |
| 230 | } |
| 231 | variables[i].NumSelectedRepos = count |
| 232 | } |
| 233 | } |
| 234 | return variables, nil |
| 235 | } |
| 236 | |
| 237 | func getVariables(client *http.Client, host string, u *safeurl.MutableSafeURL) ([]shared.Variable, error) { |
| 238 | var results []shared.Variable |
no test coverage detected