mirror of
https://github.com/actions/checkout.git
synced 2025-09-05 18:41:00 +00:00
linting
This commit is contained in:
parent
6503dcd44c
commit
630cdb3874
4 changed files with 36 additions and 22 deletions
|
@ -19,10 +19,12 @@ export async function prepareExistingDirectory(
|
|||
|
||||
// Indicates whether to delete the directory contents
|
||||
let remove = false
|
||||
|
||||
|
||||
// If preserveLocalChanges is true, log it
|
||||
if (preserveLocalChanges) {
|
||||
core.info(`Preserve local changes is enabled, will attempt to keep local files`)
|
||||
core.info(
|
||||
`Preserve local changes is enabled, will attempt to keep local files`
|
||||
)
|
||||
}
|
||||
|
||||
// Check whether using git or REST API
|
||||
|
@ -132,11 +134,17 @@ export async function prepareExistingDirectory(
|
|||
await io.rmRF(path.join(repositoryPath, file))
|
||||
}
|
||||
} else if (remove && preserveLocalChanges) {
|
||||
core.info(`Skipping deletion of directory contents due to preserve-local-changes setting`)
|
||||
core.info(
|
||||
`Skipping deletion of directory contents due to preserve-local-changes setting`
|
||||
)
|
||||
// We still need to make sure we have a git repository to work with
|
||||
if (!git) {
|
||||
core.info(`Initializing git repository to prepare for checkout with preserved changes`)
|
||||
await fs.promises.mkdir(path.join(repositoryPath, '.git'), { recursive: true })
|
||||
core.info(
|
||||
`Initializing git repository to prepare for checkout with preserved changes`
|
||||
)
|
||||
await fs.promises.mkdir(path.join(repositoryPath, '.git'), {
|
||||
recursive: true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue