Manuals / CI/CD Pipelines / Chapter 4
B · Security & Config · intermediate · Week 2–3 · Chapter 4 of 12
Secrets & environment variables
Secrets never in code or logs. GitHub Secrets, environments, and OIDC for cloud — the safe patterns.
Path progress27%
Step 1 of 4
Add a repository secret
Settings → Secrets → Actions. Reference as ${{ secrets.API_TOKEN }} in workflow.
Example
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
run: |
curl -H "Authorization: Bearer $API_TOKEN" https://api.example.com/healthDo this now
Add DUMMY_TOKEN secret. Echo in step with env: — confirm it masks in logs.
Was this step clear?
Chapter learning outcomes
- Repository secrets
- Environment secrets
- Masking in logs
- OIDC awareness
Clear these before you leave
Side quest
Leak drill
Search repo history for accidental keys — gitleaks or manual. Document clean bill.