Upsert a Repository Secret
A 3-step recipe with GitHub Actions. We can help you get access.
Recipe · 3 steps
Upsert a Repository Secret
with GitHub Actions · Configuration & Secrets Management
Works with AI assistants
Create or update an encrypted repository secret and confirm it.
- Retrieve the repository public key. The returned key_id must match the key id used to encrypt the secret value.
- Create or update the secret with the supplied encrypted value. The API returns 201 when the secret is newly created and 204 when it is updated.
- Read the secret metadata back to confirm the upsert succeeded and capture its updated timestamp.
What you'll need to have ready
- accessToken: GitHub bearer token with Actions secrets write access.
- owner: The account owner of the repository.
- repo: The name of the repository without the .git extension.
- secretName: The name of the secret to create or update.
- encryptedValue: The secret value encrypted with LibSodium using the repo public key.
- keyId: The id of the public key used to encrypt the value.
For your developer
Arazzo workflow github-actions:upsert-repo-secret, 3 operations: getRepoPublicKey → createOrUpdateRepoSecret → getRepoSecret. Specs on APIs.io.