From 89a192af9d2921a36f6fc6e84b77c182e682c574 Mon Sep 17 00:00:00 2001 From: Piotr Galar Date: Sat, 12 Aug 2023 23:31:51 +0200 Subject: [PATCH] fix: sync .complete marker when caching tools on windows --- dist/setup/index.js | 4 ++++ src/installer.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index b0a3f4e..25798cc 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -61514,6 +61514,10 @@ function cacheWindowsDir(extPath, tool, version, arch) { fs_1.default.mkdirSync(path.dirname(defaultToolCacheDir), { recursive: true }); fs_1.default.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`); + const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; + const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; + fs_1.default.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file'); + core.info(`Created link ${defaultToolCacheCompleteFile} => ${actualToolCacheCompleteFile}`); // make outer code to continue using toolcache as if it were installed on c: // restore toolcache root to default drive c: process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; diff --git a/src/installer.ts b/src/installer.ts index be90e10..3748ab5 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -203,6 +203,11 @@ async function cacheWindowsDir( fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`); + const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`; + const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`; + fs.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file'); + core.info(`Created link ${defaultToolCacheCompleteFile} => ${actualToolCacheCompleteFile}`); + // make outer code to continue using toolcache as if it were installed on c: // restore toolcache root to default drive c: process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot;