checkout: Checks out repository code under the workflow workspace so subsequent steps can access it.
What problem it solves
GitHub Actions workflows need repository files available before they can build, test, or modify code. Checkout also has to handle authentication, fetch depth, sparse working trees, submodules, and trusted workflow contexts without introducing avoidable security risks.
Key features
Configurable repository checkout — Check out the triggering repository or another repository by branch, tag, SHA, or explicit reference. The checkout location can also be changed with a relative path.
Source: README
Flexible fetch and sparse checkout — Fetch the triggering commit, complete branch and tag history, selected paths, or a partially cloned repository. Submodules, tags, Git LFS files, and cleanup behavior are also configurable.
Source: README
Token and SSH authentication — Authenticate repository fetches with a token or SSH key, then configure the selected credentials for authenticated Git commands. Credential persistence can be disabled.
Source: README
Safer trusted workflow handling — Fork pull request code is refused by default in trusted workflow triggers. Users can explicitly opt in after reviewing the associated risks.
Source: README
Credential isolation and cleanup — Persisted credentials are kept in a separate temporary file rather than directly in the local Git configuration, while normal authenticated Git commands continue to work.
Source: README
Quick start
Copied verbatim from the project's README.
- uses: actions/checkout@v7
with:
sparse-checkout: .permissions:
contents: readWho it may suit
This may suit developers and maintainers who write GitHub Actions workflows and need repository content available to later build, test, or automation steps.
Topics to discuss
Which checkout configuration patterns should be documented as recommended defaults?
How can teams adopt safer fork pull request checkout behavior without disrupting trusted workflows?
What additional examples would help users configure sparse checkout and multi-repository workflows?
Written by ReadmeX AI from the project's README, source and public GitHub data; it may contain mistakes.
Read the original README https://github.com/actions/checkout#readme
ReadmeX opened this community for a trending project; it is not run by the project. Maintainers can claim it from the community page.
Comments
…