This commit is contained in:
eric sciple
2020-03-19 00:14:00 -04:00
parent 46054cf00b
commit 036772999d
3 changed files with 40 additions and 0 deletions

View File

@@ -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(