Skip to Content
flowpact

FP304 · step-output-never-written

An output is read from a step whose inline script (`run:` or `actions/github-script`) writes other outputs, but never this one.

CodeNameCategoryDefault severityReported by
FP304step-output-never-writtenOutputs🟡 warninglint, check, the action, the editor

What you see

In the deep-nesting fixture:

▲  WARN  FP304 step-output-never-written
  Step "sum" never writes output "sha" (it writes sha256) — did you mean "sha256"?
  ▶ .github/workflows/build.yml:22:21

Why it matters

The read evaluates to an empty string. This is typically a typo in the echo "name=value" >> $GITHUB_OUTPUT line.

How to fix

Write the output in the step (echo "<name>=<value>" >> "$GITHUB_OUTPUT") or read the name it actually writes.

Example

- id: meta
  run: echo "ver=1.2.3" >> "$GITHUB_OUTPUT"
...
version: ${{ steps.meta.outputs.version }}

Scope

Only scripts whose writes flowpact can name are judged. A step is skipped when its writes cannot be seen: cat file >> "$GITHUB_OUTPUT", a computed name (core.setOutput(name, …)), or an actions/github-script script that loads a module (require(), import(); Node built-ins like fs aside), runs a program (exec.exec()), hands core to other code (run({ core })), or takes code from an expression (script: ${{ inputs.code }}). Words in strings, comments and template text do not count. Steps of other actions are not judged, since an action may set outputs of its own. Not reported in generated files, which are not edited by hand.

Accept one finding

When a finding is intended, accept it with a reason rather than turning the rule off. It is listed apart from the other findings, and does not fail the build.

On its line, with an ignore comment alone on the line above it (the editor's quick fix adds it there) or at the end of the line, after any other comment such as a version (# v4.3.0 # flowpact: ignore[FP304] why):

.github/workflows/build.yml
# flowpact: ignore[FP304] why it is acceptable here
checksum: ${{ steps.sum.outputs.sha }}

In the config, with an override, which can expire:

.github/flowpact/flowpact.config.yml
overrides:
  - rule: FP304
    target: ".github/workflows/build.yml#jobs.compile.steps.sum.outputs.sha"
    reason: Why it is acceptable here, at least 10 characters.
    expires: YYYY-MM-DD   # optional

target is the symbol the finding is about; to list them:

flowpact lint --format json | jq -r '.findings[] | select(.code == "FP304") | .symbol'

* matches within a path segment and ** across segments, so one entry accepts every finding whose symbol matches: target: '**#inputs.app-id' is that input in every workflow and action.

Change the severity

Change the severity (or turn the rule off) in .github/flowpact/flowpact.config.yml, by code or by name:

.github/flowpact/flowpact.config.yml
rules:
  FP304: off
  # or: step-output-never-written: error

Explain it in the terminal:

flowpact explain FP304
  • FP301 undefined-output-ref: An expression reads an output (needs.*, jobs.*, steps.*) that is never defined.

On this page