mirror of
https://github.com/actions/setup-go.git
synced 2025-05-04 14:14:34 +00:00
Enable caching by default with default input (#332)
This commit is contained in:
19
dist/cache-save/index.js
vendored
19
dist/cache-save/index.js
vendored
@ -60356,7 +60356,7 @@ function run() {
|
||||
if (typeof error === 'string') {
|
||||
message = error;
|
||||
}
|
||||
core.setFailed(message);
|
||||
core.warning(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -60379,6 +60379,10 @@ const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (nonExistingPaths.length) {
|
||||
logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(', ')}`);
|
||||
}
|
||||
if (!primaryKey) {
|
||||
core.info('Primary key was not generated. Please check the log messages above for more errors or information');
|
||||
return;
|
||||
}
|
||||
if (primaryKey === state) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
@ -60457,8 +60461,17 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
|
||||
});
|
||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||
const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); })));
|
||||
const cachePaths = pathList.filter(item => item);
|
||||
const pathOutputs = yield Promise.allSettled(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); })));
|
||||
const results = pathOutputs.map(item => {
|
||||
if (item.status === 'fulfilled') {
|
||||
return item.value;
|
||||
}
|
||||
else {
|
||||
core.info(`[warning]getting cache directory path failed: ${item.reason}`);
|
||||
}
|
||||
return '';
|
||||
});
|
||||
const cachePaths = results.filter(item => item);
|
||||
if (!cachePaths.length) {
|
||||
throw new Error(`Could not get cache folder paths.`);
|
||||
}
|
||||
|
20
dist/setup/index.js
vendored
20
dist/setup/index.js
vendored
@ -63130,8 +63130,17 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
|
||||
});
|
||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||
const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); })));
|
||||
const cachePaths = pathList.filter(item => item);
|
||||
const pathOutputs = yield Promise.allSettled(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); })));
|
||||
const results = pathOutputs.map(item => {
|
||||
if (item.status === 'fulfilled') {
|
||||
return item.value;
|
||||
}
|
||||
else {
|
||||
core.info(`[warning]getting cache directory path failed: ${item.reason}`);
|
||||
}
|
||||
return '';
|
||||
});
|
||||
const cachePaths = results.filter(item => item);
|
||||
if (!cachePaths.length) {
|
||||
throw new Error(`Could not get cache folder paths.`);
|
||||
}
|
||||
@ -63605,7 +63614,12 @@ function run() {
|
||||
if (cache && cache_utils_1.isCacheFeatureAvailable()) {
|
||||
const packageManager = 'default';
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
yield cache_restore_1.restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath);
|
||||
try {
|
||||
yield cache_restore_1.restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath);
|
||||
}
|
||||
catch (error) {
|
||||
core.warning(`Restore cache failed: ${error.message}`);
|
||||
}
|
||||
}
|
||||
// add problem matchers
|
||||
const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
|
||||
|
Reference in New Issue
Block a user