| 83 | } |
| 84 | |
| 85 | func putOrgSecret(client *api.Client, host string, pk *PubKey, orgName, visibility, secretName, eValue string, repositoryIDs []int64, app shared.App) error { |
| 86 | path, err := safeurl.JoinPath("orgs", orgName, string(app), "secrets", secretName) |
| 87 | if err != nil { |
| 88 | return err |
| 89 | } |
| 90 | |
| 91 | if app == shared.Dependabot { |
| 92 | repos := make([]string, len(repositoryIDs)) |
| 93 | for i, id := range repositoryIDs { |
| 94 | repos[i] = strconv.FormatInt(id, 10) |
| 95 | } |
| 96 | |
| 97 | payload := DependabotSecretPayload{ |
| 98 | EncryptedValue: eValue, |
| 99 | KeyID: pk.ID, |
| 100 | Repositories: repos, |
| 101 | Visibility: visibility, |
| 102 | } |
| 103 | |
| 104 | return putSecret(client, host, path, payload) |
| 105 | } |
| 106 | |
| 107 | payload := SecretPayload{ |
| 108 | EncryptedValue: eValue, |
| 109 | KeyID: pk.ID, |
| 110 | Repositories: repositoryIDs, |
| 111 | Visibility: visibility, |
| 112 | } |
| 113 | |
| 114 | return putSecret(client, host, path, payload) |
| 115 | } |
| 116 | |
| 117 | func putUserSecret(client *api.Client, host string, pk *PubKey, key, eValue string, repositoryIDs []int64) error { |
| 118 | payload := SecretPayload{ |