Set default cache input to false for self-hosted runners

This commit is contained in:
Sergey Dolin 2023-08-17 18:16:38 +02:00
parent 93397bea11
commit 8b0dfa3b5d
6 changed files with 102 additions and 19 deletions

View file

@ -1,4 +1,17 @@
import * as core from '@actions/core';
export enum StableReleaseAlias {
Stable = 'stable',
OldStable = 'oldstable'
}
export const isSelfHosted = (): boolean =>
process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' &&
process.env['AGENT_ISSELFHOSTED'] === '1';
export const getCacheInput = (): boolean => {
// for self-hosted environment turn off cache by default
if (isSelfHosted() && core.getInput('cache') === '') return false;
return core.getBooleanInput('cache');
};