From 5fe7a0b444b46bbb6af61a23dfcc67a918c795df Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 15 Sep 2021 00:14:44 +0300 Subject: [PATCH] minor changes --- dist/cache-save/index.js | 12 +++++++----- dist/setup/index.js | 12 +++++++----- src/cache-distributions/cache-distributor.ts | 15 ++++++++++----- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index acfe0d69..18a5b49f 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -35052,7 +35052,12 @@ class CacheDistributor { if (stderr) { throw new Error(`failed to procceed with caching with error: ${exitCode}`); } - return [stdout]; + let resolvedPath = stdout; + if (stdout.includes('~')) { + resolvedPath = path.join(os.homedir(), stdout.slice(1)); + } + core.info(`global cache directory path is ${resolvedPath}`); + return [resolvedPath]; }); } computePrimaryKey() { @@ -35063,10 +35068,7 @@ class CacheDistributor { } isCacheDirectoryExists(cacheDirectory) { const result = cacheDirectory.reduce((previousValue, currentValue) => { - const resolvePath = currentValue.includes('~') - ? path.join(os.homedir(), currentValue.slice(1)) - : currentValue; - return previousValue || fs.existsSync(resolvePath); + return previousValue || fs.existsSync(currentValue); }, false); return result; } diff --git a/dist/setup/index.js b/dist/setup/index.js index 3ef668f7..a0f9d021 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -36821,7 +36821,12 @@ class CacheDistributor { if (stderr) { throw new Error(`failed to procceed with caching with error: ${exitCode}`); } - return [stdout]; + let resolvedPath = stdout; + if (stdout.includes('~')) { + resolvedPath = path.join(os.homedir(), stdout.slice(1)); + } + core.info(`global cache directory path is ${resolvedPath}`); + return [resolvedPath]; }); } computePrimaryKey() { @@ -36832,10 +36837,7 @@ class CacheDistributor { } isCacheDirectoryExists(cacheDirectory) { const result = cacheDirectory.reduce((previousValue, currentValue) => { - const resolvePath = currentValue.includes('~') - ? path.join(os.homedir(), currentValue.slice(1)) - : currentValue; - return previousValue || fs.existsSync(resolvePath); + return previousValue || fs.existsSync(currentValue); }, false); return result; } diff --git a/src/cache-distributions/cache-distributor.ts b/src/cache-distributions/cache-distributor.ts index 9a6e956d..d5184f9c 100644 --- a/src/cache-distributions/cache-distributor.ts +++ b/src/cache-distributions/cache-distributor.ts @@ -29,7 +29,15 @@ abstract class CacheDistributor { ); } - return [stdout]; + let resolvedPath = stdout; + + if (stdout.includes('~')) { + resolvedPath = path.join(os.homedir(), stdout.slice(1)); + } + + core.info(`global cache directory path is ${resolvedPath}`); + + return [resolvedPath]; } protected async computePrimaryKey() { @@ -39,10 +47,7 @@ abstract class CacheDistributor { protected isCacheDirectoryExists(cacheDirectory: string[]) { const result = cacheDirectory.reduce((previousValue, currentValue) => { - const resolvePath = currentValue.includes('~') - ? path.join(os.homedir(), currentValue.slice(1)) - : currentValue; - return previousValue || fs.existsSync(resolvePath); + return previousValue || fs.existsSync(currentValue); }, false); return result;