Fix empty cache save on using or github.workspace(#833 in actions/cache) as path

This commit is contained in:
Lovepreet Singh
2022-07-13 11:39:29 +00:00
committed by GitHub
parent c5278cdd08
commit 120202a68c
2 changed files with 11 additions and 1 deletions

View File

@@ -52,7 +52,12 @@ export async function resolvePaths(patterns: string[]): Promise<string[]> {
.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
core.debug(`Matched: ${relativeFile}`)
// Paths are made relative so the tar entries are all relative to the root of the workspace.
paths.push(`${relativeFile}`)
if (relativeFile === "") {
// path.relative returns empty string if workspace and file are equal
paths.push(".")
} else {
paths.push(`${relativeFile}`)
}
}
return paths