expression-context
What it does
Section titled “What it does”Reports an expression that reads a context, or calls a special function, that the key it is in does not offer (env in the env of a job, runner in a matrix).
Why it matters
Section titled “Why it matters”Each key of a workflow can use only some contexts, since the others do not exist yet when it is evaluated. An expression that reads another one does not get its value.
To fix, use a context the key offers, or move the value to a key that has it.
Example
Section titled “Example”... a: runs-on: ubuntu-latest env: A: ${{ env.B }} C: ${{ github.sha }} steps: - run: echo ${{ env.B }} ${{ runner.os }} if: ${{ always() }} b: runs-on: ubuntu-latest if: ${{ runner.os == 'x' }} steps: - run: echoConfiguration
Section titled “Configuration”github-actions: lint: rules: expression-context: warn # off (default), warn, errorEnabled by the presets: github-actions/actionlint.
Suppress one line with sudsy-disable-next-line expression-context 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/context |
partial | The contexts and special functions each key offers (table in lang-github-actions/src/expression.rs). |