mirror of
https://github.com/actions/setup-python.git
synced 2025-12-25 17:53:40 +00:00
add fix
This commit is contained in:
parent
b44d7a8d91
commit
bed7d19f37
3 changed files with 24 additions and 7 deletions
|
|
@ -3,6 +3,8 @@ import * as cache from '@actions/cache';
|
|||
import * as glob from '@actions/glob';
|
||||
import * as core from '@actions/core';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
|
||||
interface PackageManager {
|
||||
command?: string;
|
||||
|
|
@ -36,11 +38,12 @@ abstract class CacheDistributor {
|
|||
}
|
||||
|
||||
protected isCacheDirectoryExists(cacheDirectory: string[]) {
|
||||
const result = cacheDirectory.reduce(
|
||||
(previousValue, currentValue) =>
|
||||
previousValue || fs.existsSync(currentValue),
|
||||
false
|
||||
);
|
||||
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
||||
const resolvePath = currentValue.includes('~')
|
||||
? path.join(currentValue.slice(1), os.homedir())
|
||||
: currentValue;
|
||||
return previousValue || fs.existsSync(currentValue);
|
||||
}, false);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue