1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-node synced 2025-06-09 21:42:20 +02:00

fix: add arch to cached path (#843)

* fix: add arch to cached path

* fix: change from using env to os module

* fix: use process.env.RUNNER_OS instead of os.platform()

* fix: remove unused var
This commit is contained in:
Peng Xiao 2024-10-24 11:31:49 +08:00 committed by GitHub
parent abb238b131
commit 39370e3970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 3 deletions

View file

@ -3,6 +3,7 @@ import * as core from '@actions/core';
import * as glob from '@actions/glob';
import path from 'path';
import fs from 'fs';
import os from 'os';
import {State} from './constants';
import {
@ -21,6 +22,7 @@ export const restoreCache = async (
throw new Error(`Caching for '${packageManager}' is not supported`);
}
const platform = process.env.RUNNER_OS;
const arch = os.arch();
const cachePaths = await getCacheDirectories(
packageManagerInfo,
@ -38,7 +40,7 @@ export const restoreCache = async (
);
}
const keyPrefix = `node-cache-${platform}-${packageManager}`;
const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`;
const primaryKey = `${keyPrefix}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`);