mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
Introduce isCacheEnabled
In order to hande empty 'cache' input
This commit is contained in:
parent
fbed9d5d06
commit
72e3f80a4a
1 changed files with 19 additions and 1 deletions
|
@ -1,7 +1,12 @@
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
|
import {
|
||||||
|
supportedPackageManagers,
|
||||||
|
PackageManagerInfo,
|
||||||
|
getCurrentPackageManager
|
||||||
|
} from './package-managers';
|
||||||
|
import {findDependencyFile} from './cache-restore';
|
||||||
|
|
||||||
export const getCommandOutput = async (toolCommand: string) => {
|
export const getCommandOutput = async (toolCommand: string) => {
|
||||||
let {stdout, stderr, exitCode} = await exec.getExecOutput(
|
let {stdout, stderr, exitCode} = await exec.getExecOutput(
|
||||||
|
@ -73,3 +78,16 @@ export function isCacheFeatureAvailable(): boolean {
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function isCacheEnabled() {
|
||||||
|
const cacheInput = core.getInput('cache');
|
||||||
|
if (cacheInput) {
|
||||||
|
return core.getBooleanInput('cache');
|
||||||
|
}
|
||||||
|
|
||||||
|
const packageManager = getCurrentPackageManager();
|
||||||
|
const packageManagerInfo = await getPackageManagerInfo(packageManager);
|
||||||
|
const cachePaths = findDependencyFile(packageManagerInfo);
|
||||||
|
|
||||||
|
return cachePaths.length > 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue