improve isHosted readability

This commit is contained in:
Sergey Dolin 2023-07-25 15:51:23 +02:00
parent 59c54a4b0b
commit 55bf2e2f65
2 changed files with 9 additions and 7 deletions

6
dist/setup/index.js vendored
View file

@ -61447,9 +61447,9 @@ function cacheWindowsDir(extPath, tool, version, arch) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (os_1.default.platform() !== 'win32') if (os_1.default.platform() !== 'win32')
return false; return false;
const isHosted = process.env['RUNNER_ENVIRONMENT'] === 'github-hosted' || // make sure the action runs in the hosted environment
process.env['AGENT_ISSELFHOSTED'] === '0'; if (process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' &&
if (!isHosted) process.env['AGENT_ISSELFHOSTED'] === '1')
return false; return false;
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE']; const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'];
if (!defaultToolCacheRoot) if (!defaultToolCacheRoot)

View file

@ -174,10 +174,12 @@ async function cacheWindowsDir(
): Promise<string | false> { ): Promise<string | false> {
if (os.platform() !== 'win32') return false; if (os.platform() !== 'win32') return false;
const isHosted = // make sure the action runs in the hosted environment
process.env['RUNNER_ENVIRONMENT'] === 'github-hosted' || if (
process.env['AGENT_ISSELFHOSTED'] === '0'; process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' &&
if (!isHosted) return false; process.env['AGENT_ISSELFHOSTED'] === '1'
)
return false;
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE']; const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'];
if (!defaultToolCacheRoot) return false; if (!defaultToolCacheRoot) return false;