CICD-035 · Validate secret configuration without printing it
Encyclopedia · Variables, outputs and data flow · All snippets
Previous · CICD-034 · Next · CICD-036
1. Where it fits
- Placement .github/workflows/ci.yml, under a job's steps.
- Prerequisites GitHub Actions job or equivalent Gitea version with environment file support.
- Platforms github-actions, gitea-actions.
- Parameters
DEPLOY_TOKEN.
2. Copy the snippet
yaml
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: test -n "$DEPLOY_TOKEN"3. How it works
An unset secret resolves to an empty value in this workflow context. test -n rejects the missing configuration without displaying the value.
4. Verify the result
Use in a trusted deployment job only. Fork PRs may have no value.
Watch for. Use the intended trusted execution context. Keep secret values out of traces, artifacts and debug output.
Validation syntax-validated (YAML parse). Status definitions.