Compare commits

...

2 Commits

Author SHA1 Message Date
Ryo Mimura
8addae5fff fix: Output chache hit timing 2024-06-21 05:44:37 +09:00
Ryo Mimura
6f5b5ee729 fix: Output chache hit timing 2024-06-21 00:09:16 +09:00
4 changed files with 4 additions and 4 deletions

View File

@ -260,7 +260,7 @@ test("Fail restore when fail on cache miss is enabled and primary + restore keys
);
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(0);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(failedMock).toHaveBeenCalledWith(
`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${key}`

View File

@ -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

View File

@ -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

View File

@ -51,6 +51,7 @@ export async function restoreImpl(
);
if (!cacheKey) {
core.setOutput(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}`
@ -62,7 +63,6 @@ export async function restoreImpl(
...restoreKeys
].join(", ")}`
);
core.setOutput(Outputs.CacheHit, false.toString());
return;
}