Skip to content

MissingNeedsJob

Needs references a missing job.

Defined by JobDependenciesRule which supports workflows in the "Default" ruleset along with JobDependencyCycle.

Description

Referencing a job that does not exist is an error. Not all dependencies can be satisfied and therefore the workflow cannot be started. Make sure all the jobs referenced in needs: exist in the workflow.

GitHub may give an error similar to this:

The workflow is not valid. .github/workflows/???.yml (Line: ?, Col: ?): Job '???' depends on unknown job '???'.

Compliant example

example2 refers to example1 as a dependency.

example.yml

name: "My Workflow"
on: push
jobs:
  example1:
    name: "My Job"
    uses: reusable/workflow.yml
  example2:
    name: "My Job"
    needs: example1
    uses: reusable/workflow.yml

Non-compliant example

example2 refers to a non-existent example3 as a dependency.

example.yml

name: "My Workflow"
on: push
jobs:
  example1:
    name: "My Job"
    uses: reusable/workflow.yml
  example2:
    name: "My Job"
    needs: example3
    uses: reusable/workflow.yml

  • Line 7: Job[example2] references Job[example3], which does not exist.