Skip to content

Home / Blog / Speed

actions/checkout: every input and every major version, v4 to v7

All 21 actions/checkout inputs with their defaults and when to change each, what v5, v6 and v7 changed, and what @v4 runs today. The inputs that decide what lands on disk, run on v4 to v7.

actions/checkout has 21 inputs and 2 outputs, and v7.0.1 is its current release. Leave most inputs alone. Change fetch-depth when a job reads history, persist-credentials when it does not push, and sparse-checkout when the repository is large. A workflow on @v4, @v5 or @v6 is not on old behaviour: those tags moved on 20 July 2026 to releases that refuse to check out a fork pull request’s code under pull_request_target, as v7 does.

In short
  • v7.0.1 is the current release, with 21 inputs and two outputs, ref and commit; every default is in the table.
  • @v4, @v5 and @v6 now run v4.4.0, v5.1.0 and v6.1.0, from 20 July 2026, which refuse fork pull request code under pull_request_target.
  • Change fetch-depth when a job reads history, persist-credentials when it does not push, and sparse-checkout when the repository is large.
  • In our run, fetch-tags with fetch-depth 1 fetched no tags on v4.4.0 and v5.1.0, and all 68 on v6.1.0 and v7.0.1.
  • v6 moved the token from .git/config to a file in the runner's temp directory; persist-credentials: false writes neither.

This is a reference for the whole action as it stands on the date this post was last checked, built from GitHub’s own files and from a workflow we ran on a GitHub-hosted runner against each major version. Where a statement comes from the run and not from GitHub, it says so.

Which version does @v4 run today?

A floating major tag such as @v4 is a moving pointer to the newest release of that major. On the date this post was last checked, each one points at a release published on 20 July 2026. GitHub’s changelog says workflows pinned to a floating major tag pick the backport up automatically, and that a SHA, minor or patch pin does not. So the table shows what each tag runs, and the change in each major that can break a workflow.

TagThe tag runsRuntimeFirst release of the majorWhat can break a workflow
v4v4.4.0, 20 July 2026node20v4.0.0, 17 October 2023v4.4.0 adds allow-unsafe-pr-checkout and, with it, the refusal to check out a fork pull request's code under pull_request_target and workflow_run.
v5v5.1.0, 20 July 2026node24v5.0.0, 11 August 2025v5.0.0 needs runner 2.327.1 or later, because it runs on Node 24. v5.1.0 adds the fork refusal.
v6v6.1.0, 20 July 2026node24v6.0.0, 20 November 2025v6.0.0 keeps the token in a file under the runner's temp directory, not in .git/config. Container actions that run authenticated git need runner 2.329.0 or later. v6.1.0 adds the fork refusal.
v7v7.0.1, 20 July 2026node24v7.0.0, 18 June 2026v7.0.0 refuses a fork pull request's code under pull_request_target and workflow_run unless allow-unsafe-pr-checkout is true.

Older majors got the same backport: v3.7.0 and v2.8.0 carry the same release note, and GitHub says v1 does not. The runtime column is read from action.yml at each tag. We also checked it on the runner, by reading the action’s own file in the runner’s actions folder: node20 for v4 and node24 for v5, v6 and v7.

Every input, with its default

The defaults are GitHub’s, read from action.yml at v7.0.1. The last column is the earliest release tag whose own action.yml lists the input; we read it from all 58 release tags. Every input in the table is in v7.

InputDefaultWhat it doesChange it whenFirst tag with it
repositorythe repository that triggered the runWhich repository to check out, as owner/name.You need a second repository. Give it a path so it does not overwrite the first.v1.0.0
refthe event's own ref or SHA; the default branch for any other repositoryThe branch, tag or SHA to check out.You build something other than the event's commit, such as a pull request's head.v1.0.0
tokengithub.tokenThe token used to fetch, and kept for later git commands unless persist-credentials is false.The repository is private and not the one running, or a push must be made as someone other than the workflow.v1.0.0
ssh-keynoneAn SSH key to fetch the repository with.A deploy key is how the repository is reached.v2.1.0
ssh-known-hostsnoneHost keys to trust besides the user's and github.com's, which is always added.The remote is not github.com.v2.1.0
ssh-stricttrueWhether to check the host key strictly (StrictHostKeyChecking=yes and CheckHostIP=no).Almost never. Add the host to ssh-known-hosts instead.v2.1.0
ssh-usergitThe user to connect to the SSH host as.The host does not use git as its user.v4.1.3
persist-credentialstrueWhether to leave the token or SSH key in the local git config for later commands.The job does not push or fetch after the checkout. Set it to false.v2.0.0
paththe workspace rootWhere under the workspace to put the repository.More than one checkout in a job.v1.0.0
cleantrueRuns git clean -ffdx and git reset --hard HEAD before fetching.The workspace already holds files you want kept. Otherwise leave it.v1.0.0
filternoneA partial clone filter such as blob:none or tree:0. When it is set, it replaces the blob:none that sparse-checkout otherwise uses.A large repository where the job needs history but not every file's contents.v4.1.0
sparse-checkoutnonePatterns, one per line, of what to write to disk. It also fetches with blob:none unless filter says otherwise.A monorepo job that needs a few directories.v3.5.3
sparse-checkout-cone-modetrueWhether the patterns are directories (cone mode) or git's older pattern syntax.You need one file rather than a directory. Set it to false.v3.5.3
fetch-depth1How many commits to fetch. 0 means all history for all branches and tags.The job reads history: a version from git describe, a changelog, blame, a diff against an earlier commit.v1.0.0
fetch-tagsfalseFetch tags even when fetch-depth is above 0.The job needs tags and not the history behind them. See the test below before relying on it in v4 or v5.v3.6.0
show-progresstrueWhether to print git's progress lines while fetching.The log is long and nobody reads the percentages.v4.0.0
lfsfalseWhether to download Git LFS files.The repository stores large files with LFS and the job needs them.v1.0.0
submodulesfalsetrue checks out submodules, recursive checks out their submodules too.The repository has submodules the job builds.v1.0.0
set-safe-directorytrueAdds the repository path to git's safe.directory list in the global config.You manage safe.directory yourself.v2.4.2
github-server-urlthe server the workflow runs onThe base URL of the GitHub instance to clone from.The repository is on another GitHub instance, such as GitHub Enterprise Server.v3.1.0
allow-unsafe-pr-checkoutfalseAllows checking out a fork pull request's code from a pull_request_target or workflow_run workflow.You have read GitHub's guidance on those events and decided the job must run the fork's code.v2.8.0 (v4.4.0, v5.1.0, v6.1.0 and v7.0.0 in the current majors)

The two outputs are ref, the branch, tag or SHA that was checked out, and commit, the SHA. Both arrived in v4.2.0. In our run commit matched the checked-out HEAD on every version. ref was refs/heads/main when we took the default branch and empty when we passed a SHA as ref, which was most of our cases.

What to change, by what the job does

Start from the job, not the input. This table is the short form of the sections below, with the setting we would put in each case.

The jobSetWhy
Reads history: git describe, a version from tags, a changelog, blamefetch-depth: 0All history for all branches and tags. The cost is in the study linked at the end.
Compares with the commit beforefetch-depth: 2, then git checkout HEAD^GitHub's own example for it.
Needs tags but not historyfetch-tags: true with fetch-depth: 1Works on v6 and v7 in our run. On v4.4.0 and v5.1.0 it fetched none.
Needs one directory of a large repositorysparse-checkout: the directoryCone mode by default, and it fetches with blob:none.
Needs one filesparse-checkout: the path, with sparse-checkout-cone-mode: falseThe root files and directories are not added.
Does not pushpersist-credentials: falseNo token is left in the workspace for later steps.
Pushes a commit from a pull requestref: ${{ github.head_ref }}A pull request run checks out a detached merge commit, so the branch must be named.
Builds the pull request's own commitref: ${{ github.event.pull_request.head.sha }}Otherwise it builds the merge of the head and the base.
Needs a second, private repositoryrepository, token and pathgithub.token is scoped to the current repository.
Has submodulessubmodules: recursiveUse true if the submodules have none of their own.

On a pull_request run, GitHub says the commit that triggered the workflow is the last merge commit on the pull request’s merge branch. A plain checkout therefore builds the result of merging the head into the base, which is usually what a test should run against. If you want the pull request’s own commit, name it.

fetch-depth: what 1, 2 and 0 leave in the repository

The default, fetch-depth: 1, fetches one commit. We checked out actions/checkout itself, pinned at its v7.0.1 commit, with each setting on each major version. The default left 1 commit and no tags. fetch-depth: 2 left 2. fetch-depth: 0 left 234 commits and 68 tags, and the repository stopped being shallow. The numbers were the same on v4, v5, v6 and v7. The point is the cost: 0 is the setting that downloads the history, and most jobs do not read it.

- uses: actions/checkout@v7
  with:
    fetch-depth: 0   # all history for all branches and tags
- run: git describe --tags

Tools that need history are the ones that fail quietly with the default: a version computed from tags, a changelog generator, git blame, a diff against the previous release. With a one-commit checkout, git describe --tags exits with an error and HEAD~1 does not exist. Our timing post measures what each setting costs on six public repositories, and says what broke.

fetch-tags: a difference between versions that we measured

fetch-tags: true is documented as fetching tags even when fetch-depth is above 0. In our run it did not on the two older majors. With a depth of 1 and fetch-tags: true, @v4 (v4.4.0) and @v5 (v5.1.0) left no tags, whether we named a commit or took the default branch. @v6 (v6.1.0) and @v7 (v7.0.1) left all 68. The changelog’s entry for v6.0.2, “Fix tag handling: preserve annotations and explicit fetch-tags”, is the likely reason, though we did not read the code to confirm it. It is one repository and one tag count, so test your own before you rely on it.

- uses: actions/checkout@v7
  with:
    fetch-depth: 1
    fetch-tags: true
- run: git tag | wc -l   # 68 on v6 and v7 in our run, 0 on v4 and v5

sparse-checkout and filter: fetch less, write less

The README says filter “overrides sparse-checkout if set”. The code is more precise. A sparse checkout fetches with filter=blob:none on its own, so the file contents it does not write are not downloaded. If you also set filter, that value is used for the fetch in place of blob:none, and the sparse patterns still apply. In our run sparse-checkout: src left 37 of the repository’s 101 files on disk and a blob:none filter in the git config, and a single file with sparse-checkout-cone-mode: false left 1.

# a directory, plus the files in the repository root
- uses: actions/checkout@v7
  with:
    sparse-checkout: |
      src

# one file, and nothing else
- uses: actions/checkout@v7
  with:
    sparse-checkout: README.md
    sparse-checkout-cone-mode: false

# all history, no file contents until git asks for them
- uses: actions/checkout@v7
  with:
    fetch-depth: 0
    filter: blob:none

A partial clone moves cost rather than removing it: the first command that needs a file’s contents fetches them then, over the network, in the middle of your job.

persist-credentials: where the token ends up

By default the checkout leaves its token configured so your later git push and git fetch work, and its post-job step removes it. What changed between majors is where it sits. On our run, @v4 and @v5 wrote an http.https://github.com/.extraheader entry into the repository’s .git/config. @v6 and @v7 wrote no such entry; they added four includeIf entries that point to a separate file in the runner’s temp directory. GitHub describes v6 the same way. With persist-credentials: false none of these were written on any version.

permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          persist-credentials: false   # this job never pushes
      - run: make test

GitHub recommends the token’s contents: read permission for the checkout unless you give it a different token or key. Setting persist-credentials: false in a job that does not push means a later step has no token to find, in .git/config or anywhere else the action put it.

pull_request_target, workflow_run and allow-unsafe-pr-checkout

pull_request_target runs in the context of the base repository’s default branch, with its token and secrets. Checking out a fork’s pull request there is the pattern GitHub calls a “pwn request”, and from 18 June 2026 v7 refuses it by default. It refuses when the pull request is from a fork and repository names the fork, or ref is refs/pull/N/head or refs/pull/N/merge, or ref is a fork pull request’s head or merge commit SHA. For workflow_run it applies only when the triggering event was a pull request event. Pull requests from the same repository, and the pull_request event, are not affected.

These are the three patterns it blocks, as GitHub lists them:

on: pull_request_target
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # each of these three steps is refused for a pull request from a fork
      - uses: actions/checkout@v7
        with:
          ref: refs/pull/${{ github.event.pull_request.number }}/merge
      - uses: actions/checkout@v7
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - uses: actions/checkout@v7
        with:
          repository: ${{ github.event.pull_request.head.repo.full_name }}
We did not run this one

We read this behaviour from GitHub’s changelog and the release notes. Our run did not trigger a pull_request_target workflow from a fork, so we have no log of the refusal to show. The input is documented as “Required to check out fork pull request code from a workflow triggered by pull_request_target or workflow_run”, and GitHub tells you to set it only after reading its guidance on those events.

Two limits are GitHub’s own. The change does not block a checkout of some other untrusted repository set in repository, and it does not cover events such as issue_comment. The workflow still has to be written carefully. Our security hardening post covers the rest of the list.

There is a second, separate change. GitHub’s changelog of 2 November 2026 says that from 2 December 2026 Actions will block pull_request_target events by default in all public repositories, unless an applicable Actions event policy explicitly allows them. Private and internal repositories are not affected. That is a platform rule and not an input of this action; the changelog says to allow the trigger through an Actions event policy.

Pin to a tag, or to a SHA?

The 20 July change is the clearest example of what a floating tag does: the same line, actions/checkout@v4, ran different code before 20 July 2026 and after it. GitHub’s security guidance lists pinning to a full-length commit SHA as a measure for a repository that cannot adopt a workflow dependency lockfile, and says to pin to a tag only if you trust its creator, because a tag can be moved or deleted if someone gains access to the action’s repository. A SHA does not move. It also does not get fixes unless something moves it: Dependabot, or whoever owns the file.

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

That SHA is the commit v7.0.1 points at on the date this post was last checked; check it against the releases page before you copy it, because a copy of a SHA from a web page is the thing the advice is about.

What we ran, and what we did not

The workflow, the script that reads each checkout back and the rows are in a public repository, in studies/A1-checkout-reference. Each major version ran nine cases against actions/checkout itself, on a GitHub-hosted ubuntu-24.04 runner (git 2.56.1), on 17 November 2026; this is the run. We ran one repository, once per version. We did not run SSH keys, LFS, submodules or a second private repository in this reference, and the table’s descriptions of those inputs are GitHub’s own text. We did not run the fork refusal. A statement above that says “in our run” is from these rows, and nothing else is.

If you are looking at the cost of a checkout and not its settings, the timing post has it, and the guide to making GitHub Actions faster puts checkout in order among the other levers. To check a workflow of your own for a deep checkout and a missing timeout, paste it into the workflow checker. We also keep a checkout cache for jobs on our runners; it is documented there, and this reference is about GitHub’s action. Build times measured on GitHub’s runner and on ours are on our faster GitHub Actions runners, measured page.

Sources

Frequently asked questions

What is the latest version of actions/checkout?

v7.0.1, released on 20 July 2026, which runs on Node 24. The floating tags @v4, @v5 and @v6 also moved on 20 July, to v4.4.0, v5.1.0 and v6.1.0, so each now refuses fork pull request code under pull_request_target.

What is the default fetch-depth in actions/checkout?

1: a single commit, for the ref or SHA that triggered the workflow. fetch-depth: 0 fetches all history for all branches and tags. In our run the default left 1 commit and no tags, and 0 left 234 commits and 68 tags.

Should I set persist-credentials to false?

Yes, in any job that does not push or fetch after the checkout. By default the token stays configured for later git commands: in .git/config on v4 and v5, and in a file under the runner's temp directory on v6 and v7.

Why did actions/checkout start failing on pull_request_target?

Since 20 July 2026 every current major refuses to check out a fork pull request's code in pull_request_target and workflow_run workflows. Review GitHub's guidance, then set allow-unsafe-pr-checkout: true only if the job must run the fork's code.

Move your CI onto our runners with one line

Change one line, watch your own build, then decide.

Connect GitHub

Card required. You pay only for the minutes your jobs run.

.github/workflows/ci.yml
jobs: test:removed: runs-on: ubuntu-latestadded: runs-on: runnersio-4vcpu-ubuntu-2604 steps: - uses: actions/checkout@v4 - run: make testadded: build:added: runs-on: runnersio-32vcpu-ubuntu-2604