minor changes

This commit is contained in:
Dmitry Shibanov 2021-09-15 00:14:44 +03:00
parent e8afe8a475
commit 5fe7a0b444
3 changed files with 24 additions and 15 deletions

View file

@ -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;