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

Function getUserSecrets

pkg/cmd/secret/list/list.go:276–300  ·  view source on GitHub ↗
(client *http.Client, host string, showSelectedRepoInfo bool)

Source from the content-addressed store, hash-verified

274}
275
276func getUserSecrets(client *http.Client, host string, showSelectedRepoInfo bool) ([]Secret, error) {
277 u, err := safeurl.JoinPath("user", "codespaces", "secrets")
278 if err != nil {
279 return nil, err
280 }
281 secrets, err := getSecrets(client, host, u)
282 if err != nil {
283 return nil, err
284 }
285
286 if showSelectedRepoInfo {
287 for i := range secrets {
288 if secrets[i].SelectedReposURL == "" {
289 continue
290 }
291 count, err := selectedRepositoryCount(client, host, safeurl.NewImmutableSafeURL(secrets[i].SelectedReposURL))
292 if err != nil {
293 return nil, fmt.Errorf("failed determining selected repositories for %s: %w", secrets[i].Name, err)
294 }
295 secrets[i].NumSelectedRepos = count
296 }
297 }
298
299 return secrets, nil
300}
301
302func getEnvSecrets(client *http.Client, repo ghrepo.Interface, envName string) ([]Secret, error) {
303 path, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "environments", envName, "secrets")

Callers 1

listRunFunction · 0.85

Calls 5

JoinPathFunction · 0.92
NewImmutableSafeURLFunction · 0.92
getSecretsFunction · 0.85
selectedRepositoryCountFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected