fix: only cache if RUNNER_TOOL_CACHE is defined

This commit is contained in:
Amin Yahyaabadi 2021-09-14 08:02:57 -05:00
parent e5bc00a601
commit d4d00ac16b
2 changed files with 5 additions and 2 deletions

View File

@ -27,7 +27,6 @@ export async function setupBin(
setupCppDir: string
): Promise<string> {
process.env.RUNNER_TEMP = process.env.RUNNER_TEMP ?? tmpdir()
process.env.RUNNER_TOOL_CACHE = process.env.RUNNER_TOOL_CACH ?? join(setupCppDir, "ToolCache")
// Build artifact name
const binName = process.platform === "win32" ? `${name}.exe` : name
@ -62,7 +61,10 @@ export async function setupBin(
endGroup()
}
// check if inside Github Actions. If so, cache the installation
if (typeof process.env.RUNNER_TOOL_CACHE === "string") {
await cacheDir(workDir, name, version)
}
return join(binDir, binName)
}

View File

@ -8,6 +8,7 @@ export async function setupTmpDir(testName: string) {
await io.rmRF(tempDirectory)
await io.mkdirP(tempDirectory)
process.env.SETUP_CPP_DIR = tempDirectory
process.env.RUNNER_TOOL_CACHE = process.env.RUNNER_TOOL_CACH ?? path.join(tempDirectory, "ToolCache")
return tempDirectory
}