1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-go synced 2025-06-09 12:02:26 +02:00

Enable caching by default with default input (#332)

This commit is contained in:
Sergey Dolin 2023-03-10 16:25:35 +01:00 committed by GitHub
parent 6b848af622
commit c51a720768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 167 additions and 6269 deletions

View file

@ -34,13 +34,23 @@ export const getPackageManagerInfo = async (packageManager: string) => {
export const getCacheDirectoryPath = async (
packageManagerInfo: PackageManagerInfo
) => {
const pathList = await Promise.all(
const pathOutputs = await Promise.allSettled(
packageManagerInfo.cacheFolderCommandList.map(async command =>
getCommandOutput(command)
)
);
const cachePaths = pathList.filter(item => item);
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.`);