mirror of
https://github.com/actions/setup-node.git
synced 2026-04-13 02:47:31 +08:00
Added Node version to cache key
This commit is contained in:
@@ -15,7 +15,8 @@ import {
|
||||
|
||||
export const restoreCache = async (
|
||||
packageManager: string,
|
||||
cacheDependencyPath: string
|
||||
cacheDependencyPath: string,
|
||||
nodeVersion: string
|
||||
) => {
|
||||
const packageManagerInfo = await getPackageManagerInfo(packageManager);
|
||||
if (!packageManagerInfo) {
|
||||
@@ -40,7 +41,7 @@ export const restoreCache = async (
|
||||
);
|
||||
}
|
||||
|
||||
const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`;
|
||||
const keyPrefix = `node-cache-${platform}-${arch}-${nodeVersion}-${packageManager}`;
|
||||
const primaryKey = `${keyPrefix}-${fileHash}`;
|
||||
core.debug(`primary key is ${primaryKey}`);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ export async function run() {
|
||||
if (cache && isCacheFeatureAvailable()) {
|
||||
core.saveState(State.CachePackageManager, cache);
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
await restoreCache(cache, cacheDependencyPath);
|
||||
await restoreCache(cache, cacheDependencyPath, version);
|
||||
}
|
||||
|
||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||
|
||||
Reference in New Issue
Block a user