Skip to main content

max-jobs-per-action

Rule catalog ID: R011

Targeted pattern scopeโ€‹

GitHub Actions workflow YAML files that declare multiple jobs.

What this rule reportsโ€‹

This rule reports workflows whose number of jobs exceeds the configured limit.

Why this rule existsโ€‹

Large workflow files become difficult to review, reason about, and evolve safely. Setting an upper bound nudges teams toward splitting unrelated concerns into smaller workflows.

โŒ Incorrectโ€‹

jobs:
one:
name: One
runs-on: ubuntu-latest
two:
name: Two
runs-on: ubuntu-latest
three:
name: Three
runs-on: ubuntu-latest
four:
name: Four
runs-on: ubuntu-latest

โœ… Correctโ€‹

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
test:
name: Test
runs-on: ubuntu-latest
build:
name: Build
runs-on: ubuntu-latest

Additional examplesโ€‹

For larger repositories, this rule is often enabled together with one of the published presets so violations are caught in pull requests before workflow changes are merged.

ESLint flat config exampleโ€‹

import githubActions from "eslint-plugin-github-actions-2";

export default [
{
files: ["**/*.{yml,yaml}"],
plugins: {
"github-actions": githubActions,
},
rules: {
"github-actions/max-jobs-per-action": "error",
},
},
];

When not to use itโ€‹

You can disable this rule when its policy does not match your repository standards, or when equivalent enforcement is already handled by another policy tool.

Further readingโ€‹