# Fast checkout

Nearly every job starts by downloading the repo. With fast checkout on, Groundbox keeps a recent copy of your repo's default branch beside the runners and puts it in the job's workspace before the first step. Your `actions/checkout` step then downloads only what changed since the copy was made. Nothing changes in the workflow. On a repo of 25,000 files, a checkout that took 10.1 seconds took 2.4 with a copy 12 hours old (how it was measured).

It is off until you turn it on: **Settings**, **GitHub**, **Fast checkout** in the dashboard, or:

```
groundbox ci checkout on    # off turns it off; no argument shows the setting and checkout times
```

The API is `GET /v1/ci/checkout/settings` (`ci:read`) and `PUT /v1/ci/checkout/settings` with `{"enabled": true}` (`ci:write`). The SDKs have `get_ci_checkout_settings` and `set_ci_fast_checkout`. The answer also has the middle checkout time of the last 7 days for jobs that started from a copy and for jobs that did not, and each job in the API has `checkout_ms` and `fast_checkout`.

- **The job gets exactly its commit.** The commit and the branch still come from GitHub, fetched by the job with its own token. The copy only saves the download of files it already has, and git checks every file by its hash.
- **Who gets the copy:** runs of the repo's own branches, and pull requests from the repo itself. A pull request from a fork and Dependabot never get it, so a private repo's files never reach code that is not yours.
- **No job can change the copy.** Only Groundbox refreshes it, from GitHub, with a token that reads that one repo. It is refreshed when a job of the repo starts and the copy is more than an hour old; jobs that start meanwhile use the copy there was. The first job after you turn it on has no copy yet and checks out as before.
- **Which jobs:** GitHub Actions jobs on Linux whose first step is a plain `actions/checkout` of the repo itself, with no `if`. A step with `repository`, `path`, `ssh-key`, `filter`, `sparse-checkout`, `lfs`, `submodules`, `fetch-tags` or `fetch-depth: 0`, and a job with a `container`, checks out as before. So does any job when there is no copy or it cannot be read: fast checkout never fails a job.
- **What the copy holds:** one commit of the default branch, with no history. Submodules and Git LFS files are not in it. A repo whose one commit is larger than 2 GB gets none. A copy no job used for a week is deleted.
- **What you will see:** one line from Groundbox in the job's **Set up job** step, and one more ref in the job's repository, `refs/groundbox/checkout-seed`, pointing at the copy's commit.

## How it was measured

On a 4 vCPU Groundbox runner, with the git commands `actions/checkout` v4 and v5 run for the default `fetch-depth: 1`, on the public repo `mastra-ai/mastra` (25,370 files, a 65 MiB download). Ten checkouts each way, one after the other, of the same commit; the time is from an empty workspace to the commit checked out, and the middle of the ten is given. Without a copy: 10.1 seconds. With a copy 12 hours older than the commit: 2.4 seconds, the 0.02 seconds to put the copy in place included. A copy one day old: 2.6 seconds; three days: 3.0; seven days: 4.1; a copy of the very commit: 0.9. A pull request's merge commit gave the same numbers. With `fetch-depth: 0` a copy with no history made the checkout slower, which is why those jobs check out as before.
