From 688d5d46889fab7d248142e89a05397103e09377 Mon Sep 17 00:00:00 2001
From: Ryo Mimura <minamimu23@gmail.com>
Date: Wed, 22 May 2024 11:37:51 +0900
Subject: [PATCH] fix: cache-hit output

---
 __tests__/restoreOnly.test.ts | 3 ++-
 dist/restore-only/index.js    | 1 +
 dist/restore/index.js         | 1 +
 src/restoreImpl.ts            | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/__tests__/restoreOnly.test.ts b/__tests__/restoreOnly.test.ts
index 81e5bca..840307d 100644
--- a/__tests__/restoreOnly.test.ts
+++ b/__tests__/restoreOnly.test.ts
@@ -86,7 +86,8 @@ test("restore with no cache found", async () => {
     );
 
     expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
-    expect(outputMock).toHaveBeenCalledTimes(1);
+    expect(outputMock).toHaveBeenCalledWith("cache-hit", "false");
+    expect(outputMock).toHaveBeenCalledTimes(2);
     expect(failedMock).toHaveBeenCalledTimes(0);
 
     expect(infoMock).toHaveBeenCalledWith(
diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js
index 9a59ac0..320cbe6 100644
--- a/dist/restore-only/index.js
+++ b/dist/restore-only/index.js
@@ -59422,6 +59422,7 @@ function restoreImpl(stateProvider, earlyExit) {
                     primaryKey,
                     ...restoreKeys
                 ].join(", ")}`);
+                core.setOutput(constants_1.Outputs.CacheHit, false.toString());
                 return;
             }
             // Store the matched cache key in states
diff --git a/dist/restore/index.js b/dist/restore/index.js
index 03a12b5..a7b6af4 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -59422,6 +59422,7 @@ function restoreImpl(stateProvider, earlyExit) {
                     primaryKey,
                     ...restoreKeys
                 ].join(", ")}`);
+                core.setOutput(constants_1.Outputs.CacheHit, false.toString());
                 return;
             }
             // Store the matched cache key in states
diff --git a/src/restoreImpl.ts b/src/restoreImpl.ts
index 74a366d..b71abd1 100644
--- a/src/restoreImpl.ts
+++ b/src/restoreImpl.ts
@@ -62,7 +62,7 @@ export async function restoreImpl(
                     ...restoreKeys
                 ].join(", ")}`
             );
-
+            core.setOutput(Outputs.CacheHit, false.toString());
             return;
         }