Added Node version to cache key

This commit is contained in:
Clinton Blackburn
2024-12-13 23:44:39 -08:00
parent 39370e3970
commit 5993da79df
4 changed files with 16 additions and 15 deletions

View File

@@ -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}`);

View File

@@ -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');