Git & GitHub Interview Question #94
What are GitHub Actions secrets?
GitHub Collaboration, Repository Rules, Issues, Releases & Actions CI/CD Mid-Level Intermediate
Quick Interview Answer
Secrets are encrypted values stored in GitHub for use by workflows without hard-coding sensitive credentials in the repository. They can be configured at repository, environment, or organization scope depending on the workflow design.
Detailed Explanation
Secrets are encrypted values stored in GitHub for use by workflows without hard-coding sensitive credentials in the repository. They can be configured at repository, environment, or organization scope depending on the workflow design.
Secrets should be granted only where needed, rotated when appropriate, and never printed intentionally. Modern cloud deployments may also use short-lived identity federation instead of storing long-lived credentials.
Code Example
steps:
- name: Use a secret
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
run: ./deploy.sh
# Never commit the real token into the YAML file.