Prompt
I'm frustrated with storing API keys in GitHub secrets everywhere
Latest observation
Totally fair — GitHub secrets are useful, but they get annoying fast when you have multiple repos, environments, forks, or rotating credentials.
A few better patterns, depending on your setup:
1. Use a secrets manager instead of per-repo GitHub secrets
Examples:
- AWS Secrets Manager / Parameter Store
- GCP Secret Manager
- Azure Key Vault
- HashiCorp Vault
- Doppler, Infisical, 1Password Secrets Automation
Why it helps: one source of truth, easier rotation, better auditing, less duplication.
2. Use OIDC for cloud auth instead of long-lived API keys
If the “API key” is actually for cloud access, GitHub Actions can often get short-lived credentials via OIDC.
Benefits:
- no stored cloud access keys in GitHub
- short-lived, scoped credentials
- easier to revoke and audit
This is especially good for AWS, GCP, and Azure.
3. Centralize reusable workflows
If you must use GitHub secrets, put the logic in a reusable workflow or composite action so you only reference secrets in one place.
Pattern:
- repositories call a central workflow
- workflow reads the secret once
- all setup/validation lives centrally
This reduces copy-paste, even if it doesn’t eliminate the secret sprawl.
4. Use environment-level secrets
If the same repo has multiple deployment targets, store secrets at the environment level:
devstagingprod
This helps with:
- separation of concerns
- approval gates
- less risk of exposing prod secrets everywhere
5. Prefer ephemeral tokens over static API keys
If your API provider supports it:
- exchange a long-lived credential for a short-lived token
- use per-job tokens
- use workload identity / service accounts
Static keys are the real pain point.
6. If you’re stuck with GitHub secrets, reduce duplication
Some practical cleanup ideas:
- use organization secrets for shared values
- standardize secret names across repos
- create a bootstrap script for adding/updating secrets
- rotate via automation, not manually
If you want, I can help you choose the best approach for your exact setup.
For example:
- “I use GitHub Actions + AWS”
- “I have 20 repos that all need the same API key”
- “I need secrets for local dev and CI”
- “I want to stop storing anything in GitHub at all”
If you tell me which one sounds closest, I’ll suggest a concrete setup.