GitHub Workflows Required Secrets and Variables
This document lists all secrets and repository variables required for GitHub Actions workflows to function correctly.Table of Contents
- Required Secrets
- Required Repository Variables
- Optional Secrets
- Setup Instructions
- Security Best Practices
- Troubleshooting
Required Secrets
GCP Authentication (Required for Deployments)
GCP_WIF_PROVIDER
- Purpose: Workload Identity Federation provider for keyless GCP authentication
- Format:
projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL/providers/PROVIDER - Used By:
deploy-gke-staging.yamldeploy-gke-production.yamlrelease.yaml
- Setup:
GCP_STAGING_SA_EMAIL
- Purpose: Service account email for staging deployments
- Format:
staging-deploy@PROJECT_ID.iam.gserviceaccount.com - Used By:
deploy-gke-staging.yaml - Permissions Required:
roles/container.developer(GKE deployments)roles/artifactregistry.writer(Docker image push)roles/logging.logWriter(Cloud Logging)roles/monitoring.metricWriter(Cloud Monitoring)
- Setup:
GCP_PRODUCTION_SA_EMAIL
- Purpose: Service account email for production deployments
- Format:
prod-deploy@PROJECT_ID.iam.gserviceaccount.com - Used By:
deploy-gke-production.yaml,release.yaml - Permissions Required: Same as staging SA
- Setup: Similar to staging SA
PyPI Publishing (Required for Releases)
PYPI_TOKEN
- Purpose: API token for publishing packages to PyPI
- Format:
pypi-AgEIcHlwaS5vcmc...(starts withpypi-) - Used By:
release.yaml - Scopes Required: Upload packages
- Setup:
- Go to https://pypi.org/manage/account/token/
- Click “Add API token”
- Name: “GitHub Actions Release”
- Scope: “Entire account” or specific project
- Copy token and add to GitHub secrets
Required Repository Variables
Configure in: Settings → Secrets and variables → Actions → VariablesGCP_PROJECT_ID
- Purpose: GCP project ID for deployments
- Example:
vishnu-sandbox-20250310 - Used By: All GCP-related workflows
- Note: Not a secret, safe to expose in logs
GCP_REGION
- Purpose: GCP region for resources
- Default:
us-central1 - Used By: Deployment workflows
ENABLE_STAGING_AUTODEPLOY
- Purpose: Enable/disable automatic staging deployments on main push
- Values:
trueorfalse - Default:
false - Used By:
deploy-gke-staging.yaml
ENABLE_DEV_AUTODEPLOY
- Purpose: Enable/disable automatic dev deployments
- Values:
trueorfalse - Default:
false - Used By:
deploy-gke-dev.yaml(if exists)
Optional Secrets
Observability and Alerting
SLACK_WEBHOOK_URL
- Purpose: Slack webhook for deployment and failure notifications
- Format:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX - Used By:
observability-alerts.yamldora-metrics.yaml
- Setup:
- Create Slack app at https://api.slack.com/apps
- Enable “Incoming Webhooks”
- Add webhook to workspace
- Copy webhook URL
PAGERDUTY_INTEGRATION_KEY
- Purpose: PagerDuty integration key for critical alerts
- Format: 32-character alphanumeric key
- Used By:
observability-alerts.yaml - Setup:
- Go to Services → your service → Integrations
- Add “Events API V2” integration
- Copy integration key
DATADOG_API_KEY
- Purpose: Datadog API key for metrics and traces
- Format: 32-character alphanumeric key
- Used By:
observability-alerts.yaml - Setup:
- Go to Organization Settings → API Keys
- Create new API key: “GitHub Actions”
- Copy key
Code Coverage
CODECOV_TOKEN
- Purpose: Codecov upload token for private repositories
- Format: UUID format
- Used By:
ci.yaml - Note: Not required for public repositories
- Setup:
- Go to https://codecov.io
- Add repository
- Copy upload token from repository settings
Setup Instructions
Quick Setup Checklist
For a new repository or organization:-
GCP Authentication
- Create Workload Identity Pool and provider
- Create staging and production service accounts
- Bind service accounts to Workload Identity
- Add
GCP_WIF_PROVIDER,GCP_STAGING_SA_EMAIL,GCP_PRODUCTION_SA_EMAILsecrets - Add
GCP_PROJECT_ID,GCP_REGIONvariables
-
PyPI Publishing (if releasing packages)
- Create PyPI API token
- Add
PYPI_TOKENsecret
-
Observability (optional)
- Create Slack webhook
- Add
SLACK_WEBHOOK_URLsecret - Set up PagerDuty integration
- Add
PAGERDUTY_INTEGRATION_KEYsecret - Set up Datadog
- Add
DATADOG_API_KEYsecret
-
Deployment Automation (optional)
- Set
ENABLE_STAGING_AUTODEPLOYvariable totrue - Set
ENABLE_DEV_AUTODEPLOYvariable totrue
- Set
Adding Secrets to GitHub
- Navigate to your repository on GitHub
- Go to Settings → Secrets and variables → Actions
- Click New repository secret
- Enter secret name (exactly as shown above)
- Paste secret value
- Click Add secret
- Go to Organization Settings → Secrets and variables → Actions
- Click New organization secret
- Select repository access (All repositories / Selected repositories)
- Add secret
Security Best Practices
Secret Rotation
Rotate secrets regularly:- GCP Service Account Keys: Not applicable (using Workload Identity)
- PyPI Tokens: Every 6 months or after personnel changes
- Webhook URLs: After security incidents only
- API Keys: Every 3-6 months
Least Privilege
Service accounts should have minimal permissions:Secret Scope
Prefer repository-specific secrets over organization-wide secrets:- Easier to track usage
- Reduced blast radius if compromised
- Better access control
Audit Logging
Monitor secret usage:Emergency Response
If a secret is compromised:- Immediately rotate/revoke the secret
- Review audit logs for unauthorized usage
- Update in GitHub with new value
- Document incident for post-mortem
- Check for data exposure from unauthorized access
Troubleshooting
Common Issues
”Error: failed to load secret”
Cause: Secret not configured or incorrect name Solution:- Verify secret name matches exactly (case-sensitive)
- Check secret is added at repository or organization level
- Ensure workflow has correct permissions
”Error: Workload Identity authentication failed”
Cause: Misconfigured Workload Identity bindings Solution:“Error: Invalid PyPI token”
Cause: Token expired, revoked, or incorrect scope Solution:- Generate new token at https://pypi.org/manage/account/token/
- Ensure scope is “Entire account” or includes your package
- Update
PYPI_TOKENsecret in GitHub
Workflow skipped due to missing secret
Cause: Workflow checksif: secrets.X != '' and secret is not set
Solution: This is expected behavior for optional secrets. Either:
- Add the secret to enable the feature
- Leave as-is if feature not needed
References
- GitHub Actions Encrypted Secrets
- GCP Workload Identity Federation
- PyPI API Tokens
- Slack Incoming Webhooks
Last Updated: 2025-11-07 Maintained By: DevOps Team Questions: Open an issue or contact the maintainers