
You cannot read a stored GitHub Actions secret value back from GitHub’s interface or API. If the original value is gone, the safe recovery process is to rotate or recreate the credential at its source, update the GitHub secret, verify the workflow, and revoke the old credential.
Do not bypass GitHub’s masking by encoding, encrypting, transforming, or printing the secret into workflow logs. That turns a missing credential into an exposure incident.
| Situation | Safe action |
|---|---|
| You still have the original credential in its source system or password manager | Verify ownership, then update GitHub if necessary |
| The credential value is lost but you control its provider | Create a replacement, update GitHub, test it, then revoke the old credential |
| The credential may have appeared in logs or artifacts | Revoke or rotate it immediately; deleting logs alone is not containment |
| You only need to know which secrets exist | List secret names and metadata; GitHub will not return their values |
| Nobody can identify the credential owner | Disable the dependent workflow or integration until ownership is resolved |
GitHub encrypts Actions secrets before they reach GitHub. Workflows can receive a secret at runtime when you explicitly reference it, but GitHub’s management surfaces expose the secret’s name and metadata—not the stored plaintext value.
The REST API can create, update, delete, and list secrets. Its list responses contain names and timestamps, not values.
GitHub also masks many secrets in logs, but its documentation warns that transformed values are not guaranteed to be redacted. Masking is a safety net, not a recovery interface.
Start with the secret name and workflow references:
rg -n "secrets\\.[A-Za-z0-9_]+" .github/workflows
List repository secret names:
gh secret list
For environment or organization secrets, use the appropriate GitHub CLI scope:
gh secret list --env production
gh secret list --org YOUR_ORG
These commands reveal names and metadata only.
Trace the dependent system:
Confirm the credential owner and least privileges before creating a replacement.
Use the provider’s normal credential-management process. Prefer:
Do not revoke the old credential until the replacement is stored and ready to test, unless you suspect exposure. For a suspected exposure, revoke first and accept the temporary outage.
In the repository interface:
Settings → Secrets and variables → Actions
Select the repository, environment, or organization scope that matches the workflow.
With GitHub CLI, the safest general form prompts for the value without putting it directly in the command line:
gh secret set SECRET_NAME
For an environment:
gh secret set SECRET_NAME --env production
For an organization, also set the intended repository visibility:
gh secret set SECRET_NAME --org YOUR_ORG --repos owner/repository
Avoid placing secret values in shell arguments, committed files, screenshots, issue comments, clipboard-history tools, or CI logs.
Run the smallest workflow path that uses the credential for its intended operation. A good verification:
Do not create a temporary workflow whose purpose is to reveal the value. If the dependent integration succeeds, you have validated the replacement without learning or exposing its plaintext in CI.
After the replacement works:
If the old value was printed or uploaded anywhere, assume it was exposed. Rotate it even if the log was private and later deleted.
Do not:
Anyone with sufficient workflow-write access can often cause a referenced secret to be used by a runner. Protect workflow changes, third-party actions, environments, and token permissions accordingly.
GITHUB_TOKEN permissions.For AWS-backed workflows, combine secret rotation with least-privilege IAM managed through Terraform and use the Terraform and AWS CLI policy-discovery workflow to narrow permissions. Browse the curated DevOps guides and AWS guides for the surrounding operational practices.
gh secretGitHub documentation and commands were checked on July 31, 2026.