invalid-expression
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”The mistake shows only after the workflow is pushed, when the run fails.
To fix, correct the expression.
Example
Section titled “Example”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.shaConfiguration
Section titled “Configuration”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.
Upstream equivalents
Section titled “Upstream equivalents”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. |