mirror of
https://github.com/actions/checkout.git
synced 2026-01-20 07:38:53 +08:00
.
This commit is contained in:
parent
46054cf00b
commit
036772999d
3 changed files with 40 additions and 0 deletions
|
|
@ -53,6 +53,7 @@ export async function prepareExistingDirectory(
|
|||
}
|
||||
|
||||
try {
|
||||
core.startGroup('Removing previously created refs, to avoid conflicts')
|
||||
// Checkout detached HEAD
|
||||
if (!(await git.isDetached())) {
|
||||
await git.checkoutDetach()
|
||||
|
|
@ -69,9 +70,11 @@ export async function prepareExistingDirectory(
|
|||
for (const branch of branches) {
|
||||
await git.branchDelete(true, branch)
|
||||
}
|
||||
core.endGroup()
|
||||
|
||||
// Clean
|
||||
if (clean) {
|
||||
core.startGroup('Cleaning the repository')
|
||||
if (!(await git.tryClean())) {
|
||||
core.debug(
|
||||
`The clean command failed. This might be caused by: 1) path too long, 2) permission issue, or 3) file in use. For futher investigation, manually run 'git clean -ffdx' on the directory '${repositoryPath}'.`
|
||||
|
|
@ -80,6 +83,7 @@ export async function prepareExistingDirectory(
|
|||
} else if (!(await git.tryReset())) {
|
||||
remove = true
|
||||
}
|
||||
core.endGroup()
|
||||
|
||||
if (remove) {
|
||||
core.warning(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue