Share an Organization Secret with Selected Repositories
A 4-step recipe with GitHub Actions. We can help you get access.
Recipe · 4 steps
Share an Organization Secret with Selected Repositories
with GitHub Actions · Configuration & Secrets Management
Works with AI assistants
Create a selected-visibility org secret and scope it to repositories.
- Retrieve the organization public key whose key_id must match the key used to encrypt the secret value.
- Create or update the organization secret with selected visibility. Returns 201 when newly created and 204 when updated.
- Replace the secret's repository allow list with the supplied repository ids. Returns 204 with no body.
- List the repositories now scoped to the secret to confirm the allow list.
What you'll need to have ready
- accessToken: GitHub bearer token with organization secrets admin access.
- org: The organization name.
- secretName: The name of the organization secret to create or update.
- encryptedValue: The secret value encrypted with LibSodium using the org public key.
- keyId: The id of the public key used to encrypt the value.
- selectedRepositoryIds: The repository ids that may access the secret.
For your developer
Arazzo workflow github-actions:share-org-secret, 4 operations: getOrgPublicKey → createOrUpdateOrgSecret → setSelectedReposForOrgSecret → listSelectedReposForOrgSecret. Specs on APIs.io.