Skip to Content
flowpact

FP608 · undefined-needs-job

A job lists a job under `needs:` that does not exist.

CodeNameCategoryDefault severityReported by
FP608undefined-needs-jobGraph structure🔴 errorlint, check, the action, the editor

What you see

In the cycles fixture:

✖  ERROR  FP608 undefined-needs-job
  jobs.report needs "linting", which is not a job in .github/workflows/main.yml (jobs: stage-b, missing, remote, report)
  ▶ .github/workflows/main.yml:12:22

Why it matters

GitHub rejects the workflow when it is triggered.

How to fix

Fix the job id or remove the dependency.

Example

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: make
  deploy:
    needs: biuld   # no job "biuld"
    runs-on: ubuntu-latest
    steps:
      - run: make deploy

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

.github/workflows/main.yml
# flowpact: ignore[FP608] why it is acceptable here
needs: [stage-b, linting]

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

.github/flowpact/flowpact.config.yml
overrides:
  - rule: FP608
    target: ".github/workflows/main.yml#jobs.linting"
    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 == "FP608") | .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:
  FP608: off
  # or: undefined-needs-job: error

Explain it in the terminal:

flowpact explain FP608
  • FP302 output-ref-without-needs: needs.<job> is read where the needs context does not contain <job>.

On this page