Enterprise Secrets Audit
Advanced15 min
Audit and manage repository and organization secrets used in GitHub Actions to ensure security and compliance.
Prerequisites
- -GitHub CLI (gh) installed and authenticated
- -Repository or organization admin access
Steps
1
List repository secrets
View all secrets configured for the current repository.
$ gh secret list
2
List organization secrets
View secrets available at the organization level.
$ gh secret list --org <org-name>
3
Set a new repository secret
Create or update a secret for GitHub Actions.
$ gh secret set API_KEY --body 'your-secret-value'
For multi-line secrets or files, use: gh secret set KEY < secret-file.txt
Secret values are write-only. You cannot read them back after setting them.
4
List environment-scoped secrets
View secrets scoped to a specific deployment environment.
$ gh secret list --env production
5
Remove a secret
Delete a secret that is no longer needed.
$ gh secret delete OLD_API_KEY
Full Script
FAQ
Discussion
Loading comments...