Skip to content

TooManyJobs

Workflow has too many jobs.

Defined by ComponentCountRule which supports workflows, actions in the "Default" ruleset along with TooManySteps.

Description

Workflow complexity is too high.

Consider the following refactors to reduce complexity: * Introduce a matrix to reduce duplication. * Split the workflow into multiple nested workflows with workflow_call.

Compliant example

Simple workflow with only a single job.

example.yml

on: push
jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"

Non-compliant example

Complex workflow with 5 reusable workflow calls and 5 normal jobs.

example.yml

on: push
jobs:
  example1:
    uses: other/workflow.yml
  example2:
    uses: other/workflow.yml
  example3:
    uses: other/workflow.yml
  example4:
    uses: other/workflow.yml
  example5:
    uses: other/workflow.yml
  example6:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"
  example7:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"
  example8:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"
  example9:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"
  example10:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"
  example11:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"

  • Line 2: Workflow[example] has 11 jobs, maximum recommended is 10.