Fix empty cache save on using or github.workspace(#833 in actions/cache) as path
This commit is contained in:
1 parent
4494306e7f
commit
8ccf58a6eb
2 files changed
+11
-1
No files matched your search
@@ -32,3 +32,8 @@ test('assertDefined throws if undefined', () => {
|
|||||||
test('assertDefined returns value', () => {
|
test('assertDefined returns value', () => {
|
||||||
expect(cacheUtils.assertDefined('test', 5)).toBe(5)
|
expect(cacheUtils.assertDefined('test', 5)).toBe(5)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('resolvePaths works on current directory', async () => {
|
||||||
|
const resolvedPath = await cacheUtils.resolvePaths(['.'])
|
||||||
|
expect(resolvedPath).toBe(['.'])
|
||||||
|
})
|
||||||
@@ -52,7 +52,12 @@ export async function resolvePaths(patterns: string[]): Promise<string[]> {
|
|||||||
.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||||
core.debug(`Matched: ${relativeFile}`)
|
core.debug(`Matched: ${relativeFile}`)
|
||||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
// 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
|
return paths
|
||||||
|
|||||||
Reference in new issue
Block a user