1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-08-14 17:30:50 +00:00

try preserve local changes option

This commit is contained in:
Salman Muin Kayser Chishti 2025-08-11 12:21:31 +01:00
parent 9f265659d3
commit 45fe6460ed
6 changed files with 59 additions and 6 deletions

View file

@ -96,6 +96,11 @@ 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
preserveLocalChanges: ''
# Partially clone against a given filter. Overrides sparse-checkout if set.
# Default: null
filter: ''
@ -332,6 +337,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
preserveLocalChanges: 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: