JobDependencyCycle
¶
Cycle in job dependencies (needs).
Defined by JobDependenciesRule
which supports workflows in the "Default" ruleset along with MissingNeedsJob
.
Description¶
Having a cycle in the job dependency graph is an error. There must be a starting point in the workflow to start the workflow run.
GitHub may give an error similar to this:
The workflow is not valid.
.github/workflows/???.yml
(Line: ?, Col: ?): The workflow must contain at least one job with no dependencies.
Compliant examples¶
Compliant example #1¶
Jobs don't have dependencies.
example.yml
name: "My Workflow" on: push jobs: example: name: "My Job" uses: reusable/workflow.yml
Compliant example #2¶
There's a job to start with (example1
).
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¶
Circular dependency between jobs.
example.yml
name: "My Workflow" on: push jobs: example1: name: "My Job 1 -> 2" needs: example2 uses: reusable/workflow.yml example2: name: "My Job 2 -> 1" needs: example1 uses: reusable/workflow.yml
- Line 4: Job[example1] forms a dependency cycle: [example1, example2].