Skip to content

invalid-expression

GitHub Actionscorrectnessno fixdefault: errorgithub-actions/actionlint

Reports a ${{ }} expression that is not closed or is empty, that does not parse (unbalanced brackets, a string that is not closed, a character expressions do not have, such as a double quote), or that names a context or function that does not exist.

The mistake shows only after the workflow is pushed, when the run fails.

To fix, correct the expression.

Reported
name: ${{ github.workflow }}
env:
B: ${{ }}
C: ${{ foo.bar }}
D: ${{ contains(github.ref, 'x' }}
E: ${{ nope(1) }}
F: ${{ "a" }}
G: ${{ format('{0} }}', env.A) }}
H: ${{ github.event.commits[0].message }}
I: ${{ github.ref == 'it''s' && !cancelled() }}
J: ${{ secrets.X }}-${{ inputs.y }}
K: ${{ github.event. }}
A: ${{ github.sha
github-actions:
lint:
rules:
invalid-expression: error # off, warn, error (default)

Enabled by the presets: github-actions/actionlint.

Suppress one line with sudsy-disable-next-line invalid-expression in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
actionlint expression/syntax partial The grammar is not parsed: a misplaced operator or a missing operand is not reported.