mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
fix path
This commit is contained in:
parent
45e3aba990
commit
e8afe8a475
4 changed files with 22 additions and 11 deletions
8
dist/cache-save/index.js
vendored
8
dist/cache-save/index.js
vendored
|
@ -35064,7 +35064,7 @@ class CacheDistributor {
|
||||||
isCacheDirectoryExists(cacheDirectory) {
|
isCacheDirectoryExists(cacheDirectory) {
|
||||||
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
||||||
const resolvePath = currentValue.includes('~')
|
const resolvePath = currentValue.includes('~')
|
||||||
? path.join(currentValue.slice(1), os.homedir())
|
? path.join(os.homedir(), currentValue.slice(1))
|
||||||
: currentValue;
|
: currentValue;
|
||||||
return previousValue || fs.existsSync(resolvePath);
|
return previousValue || fs.existsSync(resolvePath);
|
||||||
}, false);
|
}, false);
|
||||||
|
@ -46564,11 +46564,17 @@ const core = __importStar(__webpack_require__(470));
|
||||||
const cache_factory_1 = __webpack_require__(633);
|
const cache_factory_1 = __webpack_require__(633);
|
||||||
function cacheSave() {
|
function cacheSave() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
const cache = core.getInput('cache');
|
const cache = core.getInput('cache');
|
||||||
if (cache) {
|
if (cache) {
|
||||||
const cacheManager = cache_factory_1.getCache(cache, '');
|
const cacheManager = cache_factory_1.getCache(cache, '');
|
||||||
cacheManager.saveCache();
|
cacheManager.saveCache();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
core.setFailed(err.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.cacheSave = cacheSave;
|
exports.cacheSave = cacheSave;
|
||||||
|
|
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
|
@ -36833,7 +36833,7 @@ class CacheDistributor {
|
||||||
isCacheDirectoryExists(cacheDirectory) {
|
isCacheDirectoryExists(cacheDirectory) {
|
||||||
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
||||||
const resolvePath = currentValue.includes('~')
|
const resolvePath = currentValue.includes('~')
|
||||||
? path.join(currentValue.slice(1), os.homedir())
|
? path.join(os.homedir(), currentValue.slice(1))
|
||||||
: currentValue;
|
: currentValue;
|
||||||
return previousValue || fs.existsSync(resolvePath);
|
return previousValue || fs.existsSync(resolvePath);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
@ -40,7 +40,7 @@ abstract class CacheDistributor {
|
||||||
protected isCacheDirectoryExists(cacheDirectory: string[]) {
|
protected isCacheDirectoryExists(cacheDirectory: string[]) {
|
||||||
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
||||||
const resolvePath = currentValue.includes('~')
|
const resolvePath = currentValue.includes('~')
|
||||||
? path.join(currentValue.slice(1), os.homedir())
|
? path.join(os.homedir(), currentValue.slice(1))
|
||||||
: currentValue;
|
: currentValue;
|
||||||
return previousValue || fs.existsSync(resolvePath);
|
return previousValue || fs.existsSync(resolvePath);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
@ -2,11 +2,16 @@ import * as core from '@actions/core';
|
||||||
import {getCache} from './cache-distributions/cache-factory';
|
import {getCache} from './cache-distributions/cache-factory';
|
||||||
|
|
||||||
export async function cacheSave() {
|
export async function cacheSave() {
|
||||||
|
try {
|
||||||
const cache = core.getInput('cache');
|
const cache = core.getInput('cache');
|
||||||
if (cache) {
|
if (cache) {
|
||||||
const cacheManager = getCache(cache, '');
|
const cacheManager = getCache(cache, '');
|
||||||
cacheManager.saveCache();
|
cacheManager.saveCache();
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const err = error as Error;
|
||||||
|
core.setFailed(err.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheSave();
|
cacheSave();
|
||||||
|
|
Loading…
Add table
Reference in a new issue