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

← All GitHub Actions syntax · Git commands · Cron syntax