From 55bf2e2f650a9be1549d9a6633b4bb7402d59b50 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 25 Jul 2023 15:51:23 +0200 Subject: [PATCH] improve isHosted readability --- dist/setup/index.js | 6 +++--- src/installer.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 3d93611..fcd9314 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -61447,9 +61447,9 @@ function cacheWindowsDir(extPath, tool, version, arch) { return __awaiter(this, void 0, void 0, function* () { if (os_1.default.platform() !== 'win32') return false; - const isHosted = process.env['RUNNER_ENVIRONMENT'] === 'github-hosted' || - process.env['AGENT_ISSELFHOSTED'] === '0'; - if (!isHosted) + // make sure the action runs in the hosted environment + if (process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' && + process.env['AGENT_ISSELFHOSTED'] === '1') return false; const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE']; if (!defaultToolCacheRoot) diff --git a/src/installer.ts b/src/installer.ts index 9653839..be90e10 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -174,10 +174,12 @@ async function cacheWindowsDir( ): Promise { if (os.platform() !== 'win32') return false; - const isHosted = - process.env['RUNNER_ENVIRONMENT'] === 'github-hosted' || - process.env['AGENT_ISSELFHOSTED'] === '0'; - if (!isHosted) return false; + // make sure the action runs in the hosted environment + if ( + process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' && + process.env['AGENT_ISSELFHOSTED'] === '1' + ) + return false; const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE']; if (!defaultToolCacheRoot) return false;