Skip to Content
flowpact

FP301 · undefined-output-ref

An expression reads an output (`needs.*`, `jobs.*`, `steps.*`) that is never defined.

CodeNameCategoryDefault severityReported by
FP301undefined-output-refOutputs🔴 errorlint, check, the action, the editor

What you see

In the composite-actions fixture:

✖  ERROR  FP301 undefined-output-ref
  Step "tools" runs after this step, so its outputs are not available yet
  ▶ .github/workflows/build.yml:9:30

Why it matters

Undefined outputs evaluate to an empty string. Downstream jobs then run with missing versions, tags or flags.

How to fix

Fix the output name, declare the output on the job/workflow/action, or reference the right job or step. In a composite action, a step writing to $GITHUB_OUTPUT sets its own output, not the action's: give the step an id and map the output under the action's outputs: (value: ${{ steps.<id>.outputs.<name> }}).

Example

jobs:
  build:
    outputs:
      version: ${{ steps.meta.outputs.version }}
  deploy:
    needs: build
    run: deploy ${{ needs.build.outputs.vesion }}

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[FP301] why):

.github/workflows/build.yml
# flowpact: ignore[FP301] why it is acceptable here
- run: echo "tools ${{ steps.tools.outputs.version }}"

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

.github/flowpact/flowpact.config.yml
overrides:
  - rule: FP301
    target: ".github/workflows/build.yml#jobs.build.steps.tools.outputs.version"
    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 == "FP301") | .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:
  FP301: off
  # or: undefined-output-ref: error

Explain it in the terminal:

flowpact explain FP301
  • FP302 output-ref-without-needs: needs.<job> is read where the needs context does not contain <job>.
  • 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.
  • FP303 unused-output: A job output, or an output of an internal reusable workflow or action, is declared but nothing reads it.
  • Remote interfaces

On this page