- All playbooks
- Unnecessary work
- Fetch only the repository history a job needs
Fetch only the repository history a job needs
Limit checkout depth and fetched refs to the comparisons or release history the job actually consumes.
How companies used this technique
Read what each company changed and follow the original sources.
Give each checkout only the files and history it uses
Linear capped fetch depth, removed checkout from jobs that never used a working tree, and used sparse, blobless checkouts where it diffs paths. Capping fetch depth took the slowest change-detection gate from 94 to 20 seconds; removing checkout from jobs that never needed a working tree took them from 27 to 7 seconds.
The median duration of the change-detection job fell from 26 to 8 seconds, p90 from 31 to 12 seconds, and the slowest run from 138 to 37 seconds. Source
- Use it when
- A job uses only GitHub API metadata or a bounded subset of the repository.
- Before applying it
- Resolve merge bases, local actions, hashFiles and indirect scripts first. API-only jobs need an explicit repository context; history-dependent checks must retain enough history.
Fetch only the release history the job consumes
The workspace test workflow removed fetch-depth: 0 while preserving the triggering workflow’s head SHA. Release publishing now fetches only main’s history, deepening it in batches without tags.
Release publishing deepens main’s history in batches of 50 commits, without tags. Source
- Use it when
- Tests consume a source tree without history-based versioning or change detection.
- Before applying it
- Test tags and ancestry before giving release automation a shallow checkout.
Check out only the history the job reads
Four lint and test workflows in frontier-evals switched from a full-history checkout to a single commit, and three of them stopped downloading LFS files.
Four workflows check out one commit, and the three lint workflows stopped fetching LFS files Source
- Use it when
- Checkout steps fetch full history or LFS files that the job never reads.
- Before applying it
- Jobs that compute versions, changelogs or diffs from Git history still need full history.
Fetch the comparison, not every branch
Stripe iOS replaced a fetch that could pull every branch with a shallow checkout of the PR head followed by progressively deeper fetches of only the PR and master histories until their merge base resolves.
Some jobs had spent up to 30+ minutes fetching history; in Stripe’s combined CI runs with the related changes, lint went from about 7 to about 6 minutes. Source
- Use it when
- Checkout dominates CI, but lint or affected-target selection needs history.
- Before applying it
- Change detection needs a verified comparison base. Validate the PR head, the base and the merged tree, and run the full check whenever the base is ambiguous.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed