From 49141160ecf0feef9bac68120bebee5b4c83bf1f Mon Sep 17 00:00:00 2001
From: Matthijs van der Burgh <MatthijsBurgh@outlook.com>
Date: Thu, 17 Nov 2022 13:26:26 +0100
Subject: [PATCH] feat(cache) use restoreKeys as backup to hit cache

Fixes
---
 src/cache-restore.ts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cache-restore.ts b/src/cache-restore.ts
index 7f761da4..a1b46233 100644
--- a/src/cache-restore.ts
+++ b/src/cache-restore.ts
@@ -37,11 +37,13 @@ export const restoreCache = async (
   }
 
   const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
+  const restoreKeys = [`node-cache-${platform}-${packageManager}-`];
   core.debug(`primary key is ${primaryKey}`);
+  core.debug(`restore keys are [${restoreKeys}]`);
 
   core.saveState(State.CachePrimaryKey, primaryKey);
 
-  const cacheKey = await cache.restoreCache([cachePath], primaryKey);
+  const cacheKey = await cache.restoreCache([cachePath], primaryKey, restoreKeys);
   core.setOutput('cache-hit', Boolean(cacheKey));
 
   if (!cacheKey) {