MissingJobTimeout
¶
Job is missing a timeout.
Defined by MissingJobTimeoutRule
which supports workflows in the "Default" ruleset.
Description¶
Timeouts are important to prevent stuck jobs from blocking the workflow.
The default value is 360 minutes, which means 6 hours. This is usually too long for most jobs, and should be set explicitly to a lower value.
Fun fact: 360 minutes is actually a hard limit on the job length, and not a friendly default.
This should save resources:
- You'll get an error faster in case something is stuck.
- You'll get less billed minutes because of used minutes. Especially important on macOS (10x) runners.
- Other jobs will be able to run due to concurrency limits.
- You'll contribute to a greener planet due to less data-center usage.
Compliant examples¶
Compliant example #1¶
Timeout is declared, job will be cancelled early.
example.yml
on: push jobs: example: runs-on: ubuntu-latest timeout-minutes: 1 steps: - run: while true; do echo "Infinite"; done
Compliant example #2¶
An additional recommendation for better developer experience: Set a timeout on the longest-running steps inside a job.
When running integration tests which are known to complete in 30 minutes, but are sometimes hanging or get stuck, it's useful to set the job timeout to 35 minutes, and the step timeout to 30 minutes. This will ensure that there's enough time for setup and teardown, including uploading artifact reports for a partial test execution after a cancelled test run.
example.yml
on: push jobs: example: runs-on: ubuntu-latest timeout-minutes: 35 steps: - uses: actions/checkout@v4 - run: ./scripts/integration-tests.sh timeout-minutes: 30 - uses: actions/upload-artifact@v4 if: success() || failure() with: path: modules/**/test-reports
Non-compliant example¶
Timeout is missing, this job will run for 6 hours.
Will probably crash before that while running out of disk space because of incessant logging.
example.yml
on: push jobs: example: runs-on: ubuntu-latest steps: - run: while true; do echo "Infinite"; done
- Line 3: Job[example] is missing
timeout-minutes
.