1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-08-14 17:30:50 +00:00
This commit is contained in:
Salman Chishti 2025-08-13 15:01:23 +01:00 committed by GitHub
commit 6452e1970f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 446 additions and 27 deletions

View file

@ -104,6 +104,12 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
# Default: true
clean: ''
# Whether to preserve local changes during checkout. If true, tries to preserve
# local files that are not tracked by Git. By default, all files will be
# overwritten.
# Default: false
preserve-local-changes: ''
# Partially clone against a given filter. Overrides sparse-checkout if set.
# Default: null
filter: ''
@ -349,6 +355,21 @@ jobs:
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
## Preserve local changes during checkout
```yaml
steps:
- name: Create file before checkout
shell: pwsh
run: New-Item -Path . -Name "example.txt" -ItemType "File"
- name: Checkout with preserving local changes
uses: actions/checkout@v5
with:
clean: false
preserve-local-changes: true
```
# Recommended permissions
When using the `checkout` action in your GitHub Actions workflow, it is recommended to set the following `GITHUB_TOKEN` permissions to ensure proper functionality, unless alternative auth is provided via the `token` or `ssh-key` inputs: