expressions
${{ <expression> }}
GitHub Actions expressions are evaluated by the runner and interpolated into YAML values before shells see them. They support literals, operators, contexts, and a fixed set of functions — this is unrelated to Terraform's `${}` interpolation.
${{ <context.path> <op> <literal> && function(x) }} Common values / subkeys
| Value / Subkey | Purpose |
|---|---|
| ==, !=, <, <=, >, >= | Comparison operators |
| &&, ||, ! | Logical operators |
| contains / startsWith / endsWith | String and collection tests |
| format / join / toJSON / fromJSON / hashFiles | Value transforms |
| success() / failure() / cancelled() / always() | Status check functions |
| .* filter | `array.*.field` projects a field across a list |
Examples
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} Boolean expression on a step or job
run: echo ${{ format('build-{0}-{1}', matrix.os, matrix.node) }} String formatting with positional args
if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }} Object filter + contains membership test
with:
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} Interpolate into an action input
Gotcha
`if:` accepts a bare expression without `${{ }}`, but every other field requires the braces; expressions coerce to strings at YAML boundaries, so `${{ true }}` renders as `'true'` — compare with `== 'true'`.
Related keywords
contains / startsWith / format / join / fromJSON
Built-in functions available inside `${{ }}` expressions. GitHub Actions does not allow user-defined functions — only the documented list is valid.
${{ github }}
The `github` context exposes information about the workflow run, event payload, repository, and actor. It is available in most expression fields and is the primary source of triggering-event data.
if:
Conditional expression that controls whether a job or step runs. On a job it gates the entire job; on a step it gates only that step, and both automatically wrap the value in an implicit `${{ }}` if omitted.