diff --git a/__tests__/cache-restore.test.ts b/__tests__/cache-restore.test.ts index 8ff99b07..94c6aba6 100644 --- a/__tests__/cache-restore.test.ts +++ b/__tests__/cache-restore.test.ts @@ -9,7 +9,10 @@ import {restoreCache} from '../src/cache-restore'; describe('cache-restore', () => { process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); - const platform = 'Linux'; + if (!process.env.RUNNER_OS) { + process.env.RUNNER_OS = 'Linux'; + } + const platform = process.env.RUNNER_OS; const arch = 'arm64'; const commonPath = '/some/random/path'; const npmCachePath = `${commonPath}/npm`; @@ -107,9 +110,6 @@ describe('cache-restore', () => { // os archSpy = jest.spyOn(osm, 'arch'); archSpy.mockImplementation(() => arch); - - platformSpy = jest.spyOn(osm, 'platform'); - platformSpy.mockImplementation(() => platform); }); describe('Validate provided package manager', () => { diff --git a/dist/setup/index.js b/dist/setup/index.js index d9e70011..5465f259 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -92567,7 +92567,7 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, if (!packageManagerInfo) { throw new Error(`Caching for '${packageManager}' is not supported`); } - const platform = os_1.default.platform(); + const platform = process.env.RUNNER_OS; const arch = os_1.default.arch(); const cachePaths = yield (0, cache_utils_1.getCacheDirectories)(packageManagerInfo, cacheDependencyPath); core.saveState(constants_1.State.CachePaths, cachePaths); diff --git a/src/cache-restore.ts b/src/cache-restore.ts index f5ad58ff..af12ad83 100644 --- a/src/cache-restore.ts +++ b/src/cache-restore.ts @@ -21,7 +21,7 @@ export const restoreCache = async ( if (!packageManagerInfo) { throw new Error(`Caching for '${packageManager}' is not supported`); } - const platform = os.platform(); + const platform = process.env.RUNNER_OS; const arch = os.arch(); const cachePaths = await getCacheDirectories(