[](https://github.com/actions/checkout/actions/workflows/test.yml)
[](https://github.com/actions/checkout/actions/workflows/test.yml)
# Checkout v6-beta
# Checkout v6
## What's new
## What's new
- Updated `persist-credentials` to store the credentials under `$RUNNER_TEMP` instead of directly in the local git config.
- Improved credential security: `persist-credentials` now stores credentials in a separate file under `$RUNNER_TEMP` instead of directly in `.git/config`
- This requires a minimum Actions Runner version of [v2.329.0](https://github.com/actions/runner/releases/tag/v2.329.0) to access the persisted credentials for [Docker container action](https://docs.github.com/en/actions/tutorials/use-containerized-services/create-a-docker-container-action) scenarios.
- No workflow changes required — `git fetch`, `git push`, etc. continue to work automatically
- Running authenticated git commands from a [Docker container action](https://docs.github.com/actions/sharing-automations/creating-actions/creating-a-docker-container-action) requires Actions Runner [v2.329.0](https://github.com/actions/runner/releases/tag/v2.329.0) or later
# Checkout v5
# Checkout v5
@ -51,7 +52,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
<!-- start usage -->
<!-- start usage -->
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
# Repository name with owner. For example, actions/checkout
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
# Default: ${{ github.repository }}
@ -190,7 +191,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
## Fetch only the root files
## Fetch only the root files
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
sparse-checkout: .
sparse-checkout: .
```
```
@ -198,7 +199,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
## Fetch only the root files and `.github` and `src` folder
## Fetch only the root files and `.github` and `src` folder
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
sparse-checkout: |
sparse-checkout: |
.github
.github
@ -208,7 +209,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
## Fetch only a single file
## Fetch only a single file
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
sparse-checkout: |
sparse-checkout: |
README.md
README.md
@ -218,7 +219,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
## Fetch all history for all tags and branches
## Fetch all history for all tags and branches
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
fetch-depth: 0
fetch-depth: 0
```
```
@ -226,7 +227,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
## Checkout a different branch
## Checkout a different branch
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
ref: my-branch
ref: my-branch
```
```
@ -234,7 +235,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
## Checkout HEAD^
## Checkout HEAD^
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
fetch-depth: 2
fetch-depth: 2
- run: git checkout HEAD^
- run: git checkout HEAD^
@ -244,12 +245,12 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
```yaml
```yaml
- name: Checkout
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
with:
path: main
path: main
- name: Checkout tools repo
- name: Checkout tools repo
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
with:
repository: my-org/my-tools
repository: my-org/my-tools
path: my-tools
path: my-tools
@ -260,10 +261,10 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
```yaml
```yaml
- name: Checkout
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Checkout tools repo
- name: Checkout tools repo
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
with:
repository: my-org/my-tools
repository: my-org/my-tools
path: my-tools
path: my-tools
@ -274,12 +275,12 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
```yaml
```yaml
- name: Checkout
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
with:
path: main
path: main
- name: Checkout private tools
- name: Checkout private tools
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
with:
repository: my-org/my-private-tools
repository: my-org/my-private-tools
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
@ -292,7 +293,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
## Checkout pull request HEAD commit instead of merge commit
## Checkout pull request HEAD commit instead of merge commit
```yaml
```yaml
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
with:
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.event.pull_request.head.sha }}
```
```
@ -308,7 +309,7 @@ jobs:
build:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
```
```
## Push a commit using the built-in token
## Push a commit using the built-in token
@ -319,7 +320,7 @@ jobs:
build:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- run: |
- run: |
date > generated.txt
date > generated.txt
# Note: the following account information will not work on GHES
# Note: the following account information will not work on GHES