expression-types
What it does
Section titled “What it does”Reports an expression whose types do not fit: a property that an object does not have, a comparison of values that cannot be compared, a wrong number or type of arguments, or an object where text is expected.
Why it matters
Section titled “Why it matters”Expressions fail without an error: a property that does not exist is an empty string, and an object where text is expected becomes the text Object. The workflow runs with a wrong value.
To fix, correct the property, or the types.
Example
Section titled “Example”... workflow_call: secrets: token: {}run-name: ${{ github.events }}jobs: a: runs-on: ubuntu-latest... os: [a, b] v: "${{ fromJSON('[1]') }}" steps: - run: echo ${{ github.sha }} ${{ contains('a') }} ${{ format('{0} {1}', 1) }} - run: echo ${{ fromJSON('[1') }} ${{ secrets.token }} ${{ secrets.other }} - run: echo ${{ matrix.os }} ${{ matrix.arch }} - run: echo ${{ github.event.*[github.sha] }} - run: echo ${{ inputs.nothing }} - run: echo ${{ matrix.v }} caller: uses: owner/repo/.github/workflows/w.yml@v1...Configuration
Section titled “Configuration”github-actions: lint: rules: expression-types: warn # off (default), warn, errorEnabled by the presets: github-actions/actionlint.
Suppress one line with sudsy-disable-next-line expression-types 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/types |
partial | Properties of the typed contexts, argument counts and types, format placeholders; not the types of steps, needs, matrix and inputs (they depend on other keys). |