From 8addae5ffffa871c88fbd2d8a9a43af45f069161 Mon Sep 17 00:00:00 2001
From: Ryo Mimura <minamimu23@gmail.com>
Date: Fri, 21 Jun 2024 05:44:37 +0900
Subject: [PATCH] fix: Output chache hit timing

---
 dist/restore-only/index.js | 2 +-
 dist/restore/index.js      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js
index 320cbe6..d2f3631 100644
--- a/dist/restore-only/index.js
+++ b/dist/restore-only/index.js
@@ -59415,6 +59415,7 @@ function restoreImpl(stateProvider, earlyExit) {
             const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
             const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
             if (!cacheKey) {
+                core.setOutput(constants_1.Outputs.CacheHit, false.toString());
                 if (failOnCacheMiss) {
                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);
                 }
@@ -59422,7 +59423,6 @@ 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 a7b6af4..842eaa6 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -59415,6 +59415,7 @@ function restoreImpl(stateProvider, earlyExit) {
             const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
             const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
             if (!cacheKey) {
+                core.setOutput(constants_1.Outputs.CacheHit, false.toString());
                 if (failOnCacheMiss) {
                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);
                 }
@@ -59422,7 +59423,6 @@ function restoreImpl(stateProvider, earlyExit) {
                     primaryKey,
                     ...restoreKeys
                 ].join(", ")}`);
-                core.setOutput(constants_1.Outputs.CacheHit, false.toString());
                 return;
             }
             // Store the matched cache key in states