Skip to main content

require-job-timeout-minutes

Rule catalog ID: R002

Targeted pattern scopeโ€‹

Non-reusable workflow jobs under jobs.<job_id>.

What this rule reportsโ€‹

This rule reports jobs that do not define timeout-minutes, jobs that use a non-integer timeout, and jobs that exceed the configured maxMinutes threshold.

Why this rule existsโ€‹

Explicit job timeouts make runner usage more predictable and reduce the blast radius of stuck processes or hanging external services.

โŒ Incorrectโ€‹

jobs:
test:
runs-on: ubuntu-latest
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 180

โœ… Correctโ€‹

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: ${{ fromJson(vars.CI_TIMEOUT_MINUTES) }}

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/require-job-timeout-minutes": "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โ€‹