Skip to content

Commit

Permalink
Avoid re-evaluation of the key input in restore implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Oct 5, 2024
1 parent 2cdf405 commit 5cdbd5c
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/restore-only/index.js
Original file line number Diff line number Diff line change
@@ -59427,7 +59427,7 @@ function restoreImpl(stateProvider, earlyExit) {
}
// Store the matched cache key in states
stateProvider.setState(constants_1.State.CacheMatchedKey, cacheKey);
const isExactKeyMatch = utils.isExactKeyMatch(core.getInput(constants_1.Inputs.Key, { required: true }), cacheKey);
const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey);
core.setOutput(constants_1.Outputs.CacheHit, isExactKeyMatch.toString());
if (lookupOnly) {
core.info(`Cache found and can be restored from key: ${cacheKey}`);
2 changes: 1 addition & 1 deletion dist/restore/index.js
Original file line number Diff line number Diff line change
@@ -59427,7 +59427,7 @@ function restoreImpl(stateProvider, earlyExit) {
}
// Store the matched cache key in states
stateProvider.setState(constants_1.State.CacheMatchedKey, cacheKey);
const isExactKeyMatch = utils.isExactKeyMatch(core.getInput(constants_1.Inputs.Key, { required: true }), cacheKey);
const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey);
core.setOutput(constants_1.Outputs.CacheHit, isExactKeyMatch.toString());
if (lookupOnly) {
core.info(`Cache found and can be restored from key: ${cacheKey}`);
6 changes: 1 addition & 5 deletions src/restoreImpl.ts
Original file line number Diff line number Diff line change
@@ -69,11 +69,7 @@ export async function restoreImpl(
// Store the matched cache key in states
stateProvider.setState(State.CacheMatchedKey, cacheKey);

const isExactKeyMatch = utils.isExactKeyMatch(
core.getInput(Inputs.Key, { required: true }),
cacheKey
);

const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey);
core.setOutput(Outputs.CacheHit, isExactKeyMatch.toString());
if (lookupOnly) {
core.info(`Cache found and can be restored from key: ${cacheKey}`);

0 comments on commit 5cdbd5c

Please sign in to comment.