# One line caps a hung GitHub Actions job

> A frozen test can keep one GitHub Actions job running for 360 minutes. That is 6 hours.

Source: https://fullbytedeveloper.com/blog/hung-job
Published here: 2026-11-16, updated 2026-12-03

A frozen test can keep one GitHub Actions job running for 360 minutes. That is 6 hours, the default when the job has no timeout [1]. One line under each job makes GitHub stop it at your limit instead of burning a full window of runner time [1][2].

## One minute: add the ceiling

Put `timeout-minutes` under each job, next to `runs-on` [1][3]:

```yaml
jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4
```

Set the number to about 2 to 3 times that job's normal healthy run. A 5 minute unit suite often gets 15. A flaky 20 minute integration job might get 45, not 360.

## Find workflow files with no timeout

```bash
grep -rL "timeout-minutes" .github/workflows
```

On a throwaway tree with one capped and one uncapped workflow, that command printed only the uncapped file:

```text
.github/workflows/ci.yml
```

Captured setup on this host:

```bash
mkdir -p /tmp/wfdemo/.github/workflows
# ci.yml has no timeout; lint.yml sets timeout-minutes: 10
cd /tmp/wfdemo && grep -rL "timeout-minutes" .github/workflows
```

`grep -L` checks whole files, not jobs. A file where only one job (or only a step) has a timeout will not show up, so still open each job and confirm a ceiling next to `runs-on` [1].

<figure>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 250" role="img" aria-label="Unset job runs to 360 minutes; timeout-minutes stops it earlier">
  <defs>
    <marker id="hungArrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
      <path d="M0,0 L8,3 L0,6 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="720" height="250" rx="12" fill="#0b1f3a"/>
  <text x="24" y="36" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">Job starts</text>
  <path d="M120 30 H168" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#hungArrow)"/>
  <rect x="176" y="12" width="160" height="48" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="188" y="42" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">steps running</text>
  <path d="M336 36 H384" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#hungArrow)"/>
  <rect x="392" y="12" width="140" height="48" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="404" y="42" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">test freezes</text>
  <path d="M532 36 H580" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#hungArrow)"/>
  <rect x="588" y="12" width="110" height="48" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="598" y="42" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">still billed</text>
  <rect x="24" y="100" width="672" height="120" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="40" y="140" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Default ceiling</text>
  <text x="40" y="168" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">360 minutes when timeout-minutes is unset</text>
  <text x="40" y="196" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Your fix: timeout-minutes: 15 under the job (example)</text>
</svg>
</figure>

*Unset jobs inherit a six-hour ceiling; an explicit job timeout is the hard stop for a frozen step.*

## Why the number matters on the bill

Private repos: hosted runner time comes out of your plan's included usage, then gets billed. GitHub's Actions billing docs list a common baseline of $0.006 per minute for standard Linux runners on private repositories [2].

Public repos: standard GitHub-hosted runners do not burn that private meter the same way, but the check stays pending until the hung job ends. Reviewers wait. Required checks stay yellow. Merges stall for hours while nothing useful runs [1][2].

Napkin math for one uncapped hang on a private Linux runner:

```text
360 minutes * $0.006 = $2.16
15 minutes * $0.006 = $0.09
```

One forgotten ceiling is cheap compared with a week of flaky hangs. Matrix jobs multiply the problem: four OS cells without timeouts can each burn toward 360 minutes independently [2][3].

## Job timeout versus step timeout

GitHub lets you set timeouts at more than one level. A step timeout stops that step. The job can continue with later steps unless you also cap the job [1][3]. Prefer an explicit job-level `timeout-minutes` you can read next to `runs-on`, then add tighter step limits only where a single install or test is known to wedge.

Workflow-level timeouts and job-level timeouts are easy to confuse in review. Put the ceiling on the job that bills the runner minutes you care about [1].

## Pair this with cancel-in-progress

Timeouts stop hangs. Concurrency groups stop obsolete PR heads from finishing after you pushed again. Both save minutes; neither replaces the other. For cancel-replaced-run patterns and docs-only skips, see [save GitHub Actions minutes](/blog/ci-minutes).

## Mistakes that keep the six-hour window

Setting `timeout-minutes` on one job in a file and trusting `grep -L` to flag that file when another job is uncapped.

Copying `timeout-minutes: 360` "to be safe," which is the default you already had [1].

Capping a fast lint job at 5 minutes while leaving the flaky e2e job uncapped.

Putting the timeout only on a composite action step and never on the job that wraps a matrix.

Raising the timeout every time a suite slows down instead of fixing the hang, until you are back near six hours.

## Rollout that does not surprise night shifts

1. List workflows with `grep -rL "timeout-minutes" .github/workflows`.
2. Open every listed file and every multi-job file the grep missed.
3. Set a ceiling per job from recent healthy runtimes (2 to 3x).
4. Watch cancelled-by-timeout runs for a week; raise only the jobs that hit a real slow path.
5. Add concurrency cancel for PR heads separately ([ci-minutes](/blog/ci-minutes)).

When a job hits your ceiling, GitHub fails it instead of letting it idle until 360. That failure is the signal to fix the hang, not a reason to delete the timeout.

## What a timeout failure looks like in the UI

The job is marked failed with a timeout message rather than a test assertion. Required checks that depend on that job go red. That is better than a six-hour yellow pending state that blocks merges while nobody is watching [1]. Tell the team in advance so people do not "fix" a timeout by deleting the ceiling on a Friday deploy workflow.

If only one matrix cell hangs, the whole matrix job still occupies a runner until the job timeout fires unless you structure cells as separate jobs with their own ceilings [3]. Prefer per-job timeouts you can read next to each `runs-on` line.

## Self-hosted runners and bigger machines

Self-hosted runners are not free just because GitHub is not billing the hosted meter the same way. A hung job still occupies the machine, blocks the queue, and can leave browsers or emulators wedged until someone SSH's in. Timeouts reclaim the runner for the next workflow [1]. Larger hosted runners multiply the private-repo minute price, so an uncapped hang hurts more on those labels [2].

## Reusable workflows and composite actions

A reusable workflow called with `uses:` still runs jobs that need their own `timeout-minutes` in the callee or caller depending on how you structured them [1][3]. Do not assume a timeout in the caller covers every nested job. After a refactor that extracts a reusable workflow, re-run the `grep -rL` pass on both repositories if the workflow lives in a shared actions repo.

Composite actions expose step-level timing more than job-level timing. Keep the job ceiling in the workflow that pays for the runner, and add step timeouts only for known sticky installs (browser download, emulator boot).

## Flaky suites versus true hangs

A flaky test that finishes in 8 minutes does not need a 360 minute budget. A true hang (waiting on a lock, waiting on a missing service, waiting on a GUI prompt) needs a kill. If you keep raising timeouts to hide flakes, you recreate the default. Cap first, then fix the hang with better service readiness checks, deterministic ports, and fewer shared mutable fixtures. Pair with cancel-in-progress so obsolete PR heads do not keep running after a fix push ([ci-minutes](/blog/ci-minutes)).

## Audit snippet you can paste into a PR checklist

```text
[ ] Every job under .github/workflows has timeout-minutes next to runs-on
[ ] Ceilings are 2x to 3x recent healthy duration, not 360
[ ] Matrix cells cannot each burn uncapped hours
[ ] Reusable workflow jobs still carry ceilings
[ ] On-call knows a timeout failure means fix the hang, not delete the cap
```

Run the grep in CI as a policy check if your org already lints workflows. A missing string is cheaper to catch in a pull request than on the bill [2].

Also run the [five GitHub Actions workflow checks](/blog/github-actions-five-workflow-checks) on the same workflows. Browse the [Dev tools topic](https://fullbytedeveloper.com/blog/topic/dev-tools).

Send this to the friend whose stuck test kept a GitHub Actions runner burning minutes.

Image: Dark grid with a circular frame; a track of eight cubes, four teal then four amber, stops at a bright cyan barrier, with orbital teal and amber arrows around the assembly.
https://fullbytedeveloper.com/media/hung-job/hung-job-venice.webp
Work slides along the track until a hard stop. timeout-minutes is that barrier so a frozen job cannot run for six hours.

## Sources

1. [GitHub docs: timeout-minutes](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idtimeout-minutes)
2. [GitHub docs: Actions billing](https://docs.github.com/en/billing/concepts/product-billing/github-actions)
3. [GitHub docs: workflow syntax (jobs)](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobs)
