CICD-033 · Avoid shell interpolation of event fields
Encyclopedia · Variables, outputs and data flow · All snippets
Previous · CICD-032 · Next · CICD-034
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
PR_TITLE.
2. Copy the snippet
yaml
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: printf '%s\n' "$PR_TITLE"3. How it works
env passes the pull request title as process data. Quoted shell expansion retains whitespace and avoids interpreting the title as part of the command program.
4. Verify the result
Quoting treats the title as data. Keep untrusted strings out of shell source.
Validation syntax-validated (YAML parse). Status definitions.