Skip to Content
flowpact

FP303 · unused-output

A job output, or an output of an internal reusable workflow or action, is declared but nothing reads it.

CodeNameCategoryDefault severityReported by
FP303unused-outputOutputs🟡 warninglint, check, the action, the editor

What you see

In the composite-actions fixture:

▲  WARN  FP303 unused-output
  Output "cache_key" of .github/actions/install-tools is not read by any of its 1 user
  ▶ .github/actions/install-tools/action.yml:17:3

Why it matters

Unused outputs suggest a broken hand-off: either the consumer reads a different name, or the output is dead code.

How to fix

Remove the output, or make the intended consumer read it.

Example

build:
  outputs:
    version: ${{ steps.meta.outputs.version }}
    digest: ${{ steps.push.outputs.digest }}   # nothing reads needs.build.outputs.digest
deploy:
  needs: build
  steps:
    - run: deploy ${{ needs.build.outputs.version }}

Scope

Job outputs are always judged: only the jobs and workflow outputs of the same workflow can read them. Outputs of a reusable workflow or an action are judged only for an internal unit that this repository uses. Published units are not reported, because their consumers live in other repositories: reusable workflows (except files starting with _), the root action.yml, or exactly the units listed in impact.publish when it is set. Actions in subdirectories (owner/repo/restore@v1) count as internal unless impact.publish lists them. Reading the whole object (toJSON(needs.build.outputs), needs.build.outputs[matrix.key], toJSON(steps)) counts as reading every output. 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[FP303] why):

.github/actions/install-tools/action.yml
# flowpact: ignore[FP303] why it is acceptable here
cache_key:

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

.github/flowpact/flowpact.config.yml
overrides:
  - rule: FP303
    target: ".github/actions/install-tools#outputs.cache_key"
    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 == "FP303") | .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:
  FP303: off
  # or: unused-output: error

Explain it in the terminal:

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

On this page