TooManySteps
¶
Job has too many steps.
Defined by ComponentCountRule
which supports workflows, actions in the "Default" ruleset along with TooManyJobs
.
Description¶
Job complexity is too high.
Consider the following refactors to reduce complexity:
* Remove unused steps.
* Split up job into meaningful smaller jobs with needs
dependencies.
* Extract tightly coupled steps into a composite action.
* Extract common steps into a reusable composite action.
Compliant examples¶
Compliant example #1¶
Simple job with only a few steps.
example.yml
on: push jobs: example: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: echo "Example" - run: echo "Example" - run: echo "Example"
Compliant example #2¶
Simple action with only a few steps.
action.yml
name: Test description: Test runs: using: composite steps: - uses: actions/checkout@v4 - run: echo "Example" shell: bash - run: echo "Example" shell: bash - run: echo "Example" shell: bash
Non-compliant example¶
Complex job with 20 steps.
example.yml
on: push jobs: example: runs-on: ubuntu-latest steps: - run: echo "Example 1" - run: echo "Example 2" - run: echo "Example 3" - run: echo "Example 4" - run: echo "Example 5" - run: echo "Example 6" - run: echo "Example 7" - run: echo "Example 8" - run: echo "Example 9" - run: echo "Example 10" - run: echo "Example 11" - run: echo "Example 12" - run: echo "Example 13" - run: echo "Example 14" - run: echo "Example 15" - run: echo "Example 16" - run: echo "Example 17" - run: echo "Example 18" - run: echo "Example 19" - run: echo "Example 20" - run: echo "Example 21"
- Line 3: Job[example] has 21 steps, maximum recommended is 20.