mirror of
https://github.com/actions/setup-go.git
synced 2025-07-17 04:25:14 -06:00
Change behavior of the exception throwing
This commit is contained in:
parent
c64d0e04b0
commit
8c8442b8f8
5 changed files with 52 additions and 37 deletions
|
@ -1,6 +1,7 @@
|
|||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import path from 'path';
|
||||
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
|
||||
|
||||
export const getCommandOutput = async (toolCommand: string) => {
|
||||
|
@ -34,16 +35,16 @@ export const getPackageManagerInfo = async (packageManager: string) => {
|
|||
export const getCacheDirectoryPath = async (
|
||||
packageManagerInfo: PackageManagerInfo
|
||||
) => {
|
||||
let pathList: string[] = [];
|
||||
let pathList = await Promise.all(
|
||||
packageManagerInfo.cacheFolderCommandList.map(async command =>
|
||||
getCommandOutput(command)
|
||||
)
|
||||
);
|
||||
|
||||
for (let command of packageManagerInfo.cacheFolderCommandList) {
|
||||
pathList.push(await getCommandOutput(command));
|
||||
}
|
||||
const emptyPaths = pathList.filter(item => !item);
|
||||
|
||||
for (let path of pathList) {
|
||||
if (!path) {
|
||||
throw new Error(`Could not get cache folder paths.`);
|
||||
}
|
||||
if (emptyPaths.length) {
|
||||
throw new Error(`Could not get cache folder paths.`);
|
||||
}
|
||||
|
||||
return pathList;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue