|
|
|
@ -1,7 +1,12 @@
|
|
|
|
|
import * as cache from '@actions/cache';
|
|
|
|
|
import * as core from '@actions/core';
|
|
|
|
|
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) => {
|
|
|
|
|
let {stdout, stderr, exitCode} = await exec.getExecOutput(
|
|
|
|
@ -73,3 +78,16 @@ export function isCacheFeatureAvailable(): boolean {
|
|
|
|
|
);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|