(client *api.RESTClient, owner, repo, name, value string)
| 215 | } |
| 216 | |
| 217 | func setRepoSecret(client *api.RESTClient, owner, repo, name, value string) error { |
| 218 | pubKey, err := getRepoPublicKey(client, owner, repo) |
| 219 | if err != nil { |
| 220 | return fmt.Errorf("get repo public key: %w", err) |
| 221 | } |
| 222 | |
| 223 | encrypted, err := encryptWithPublicKey(pubKey.Key, value) |
| 224 | if err != nil { |
| 225 | return fmt.Errorf("encrypt secret: %w", err) |
| 226 | } |
| 227 | |
| 228 | return putRepoSecret(client, owner, repo, name, pubKey.ID, encrypted) |
| 229 | } |
| 230 | |
| 231 | func getRepoPublicKey(client *api.RESTClient, owner, repo string) (*repoPublicKey, error) { |
| 232 | var key repoPublicKey |
no test coverage detected