MCPcopy Create free account
hub / github.com/github/gh-aw / setRepoSecret

Function setRepoSecret

pkg/cli/secret_set_command.go:217–229  ·  view source on GitHub ↗
(client *api.RESTClient, owner, repo, name, value string)

Source from the content-addressed store, hash-verified

215}
216
217func 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
231func getRepoPublicKey(client *api.RESTClient, owner, repo string) (*repoPublicKey, error) {
232 var key repoPublicKey

Callers 1

newSecretsSetSubcommandFunction · 0.85

Calls 4

getRepoPublicKeyFunction · 0.85
encryptWithPublicKeyFunction · 0.85
putRepoSecretFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected