Skip to content

Commit fa3e253

Browse files
chore: build the action
1 parent 1543078 commit fa3e253

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

dist/restore-only/index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94484,11 +94484,6 @@ function restoreImpl(stateProvider, earlyExit) {
9448494484
var _a, _b, _c, _d, _e, _f, _g;
9448594485
return __awaiter(this, void 0, void 0, function* () {
9448694486
try {
94487-
core.setOutput(constants_1.Outputs.Hit, false);
94488-
core.setOutput(constants_1.Outputs.HitPrimaryKey, false);
94489-
core.setOutput(constants_1.Outputs.HitFirstMatch, false);
94490-
core.setOutput(constants_1.Outputs.RestoredKey, false);
94491-
core.setOutput(constants_1.Outputs.RestoredKeys, []);
9449294487
if (!utils.isCacheFeatureAvailable()) {
9449394488
return;
9449494489
}
@@ -94506,6 +94501,7 @@ function restoreImpl(stateProvider, earlyExit) {
9450694501
`);
9450794502
const errorNotFound = errorNot("was found");
9450894503
const errorNotRestored = errorNot("could be restored");
94504+
let hitPrimaryKey = false;
9450994505
{
9451094506
const primaryKey = inputs.primaryKey;
9451194507
stateProvider.setState(constants_1.State.CachePrimaryKey, primaryKey);
@@ -94526,7 +94522,7 @@ function restoreImpl(stateProvider, earlyExit) {
9452694522
}
9452794523
else if (utils.isExactKeyMatch(primaryKey, lookedUpPrimaryKey)) {
9452894524
utils.info(`Found a cache with the given "${constants_1.Inputs.PrimaryKey}".`);
94529-
core.setOutput(constants_1.Outputs.HitPrimaryKey, true);
94525+
hitPrimaryKey = true;
9453094526
if (!inputs.skipRestoreOnHitPrimaryKey) {
9453194527
restoredKey = yield restore.restoreCache(primaryKey);
9453294528
if (restoredKey) {
@@ -94539,6 +94535,7 @@ function restoreImpl(stateProvider, earlyExit) {
9453994535
}
9454094536
}
9454194537
}
94538+
let hitFirstMatch = false;
9454294539
if (inputs.restorePrefixesFirstMatch.length > 0 &&
9454394540
!(lookedUpPrimaryKey && inputs.skipRestoreOnHitPrimaryKey)) {
9454494541
utils.info(`
@@ -94561,7 +94558,7 @@ function restoreImpl(stateProvider, earlyExit) {
9456194558
}
9456294559
else {
9456394560
utils.info(`Found a cache using the "${constants_1.Inputs.RestorePrefixesFirstMatch}".`);
94564-
core.setOutput(constants_1.Outputs.HitFirstMatch, true);
94561+
hitFirstMatch = true;
9456594562
restoredKey = yield restore.restoreCache(lookedUpFirstMatch);
9456694563
if (restoredKey) {
9456794564
restoredKeys.push(...[restoredKey]);
@@ -94575,10 +94572,12 @@ function restoreImpl(stateProvider, earlyExit) {
9457594572
if (!(lookedUpPrimaryKey && inputs.skipRestoreOnHitPrimaryKey)) {
9457694573
restoredKeys.push(...(yield restore.restoreAllMatches()));
9457794574
}
94578-
restoredKey || (restoredKey = "");
94575+
restoredKey !== null && restoredKey !== void 0 ? restoredKey : (restoredKey = "");
9457994576
// Store the matched cache key in states
9458094577
stateProvider.setState(constants_1.State.CacheRestoredKey, restoredKey);
94581-
core.setOutput(constants_1.Outputs.Hit, true);
94578+
core.setOutput(constants_1.Outputs.HitPrimaryKey, hitPrimaryKey);
94579+
core.setOutput(constants_1.Outputs.HitFirstMatch, hitFirstMatch);
94580+
core.setOutput(constants_1.Outputs.Hit, hitPrimaryKey || hitFirstMatch);
9458294581
core.setOutput(constants_1.Outputs.RestoredKey, restoredKey);
9458394582
core.setOutput(constants_1.Outputs.RestoredKeys, restoredKeys);
9458494583
return restoredKey;

dist/restore/index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94484,11 +94484,6 @@ function restoreImpl(stateProvider, earlyExit) {
9448494484
var _a, _b, _c, _d, _e, _f, _g;
9448594485
return __awaiter(this, void 0, void 0, function* () {
9448694486
try {
94487-
core.setOutput(constants_1.Outputs.Hit, false);
94488-
core.setOutput(constants_1.Outputs.HitPrimaryKey, false);
94489-
core.setOutput(constants_1.Outputs.HitFirstMatch, false);
94490-
core.setOutput(constants_1.Outputs.RestoredKey, false);
94491-
core.setOutput(constants_1.Outputs.RestoredKeys, []);
9449294487
if (!utils.isCacheFeatureAvailable()) {
9449394488
return;
9449494489
}
@@ -94506,6 +94501,7 @@ function restoreImpl(stateProvider, earlyExit) {
9450694501
`);
9450794502
const errorNotFound = errorNot("was found");
9450894503
const errorNotRestored = errorNot("could be restored");
94504+
let hitPrimaryKey = false;
9450994505
{
9451094506
const primaryKey = inputs.primaryKey;
9451194507
stateProvider.setState(constants_1.State.CachePrimaryKey, primaryKey);
@@ -94526,7 +94522,7 @@ function restoreImpl(stateProvider, earlyExit) {
9452694522
}
9452794523
else if (utils.isExactKeyMatch(primaryKey, lookedUpPrimaryKey)) {
9452894524
utils.info(`Found a cache with the given "${constants_1.Inputs.PrimaryKey}".`);
94529-
core.setOutput(constants_1.Outputs.HitPrimaryKey, true);
94525+
hitPrimaryKey = true;
9453094526
if (!inputs.skipRestoreOnHitPrimaryKey) {
9453194527
restoredKey = yield restore.restoreCache(primaryKey);
9453294528
if (restoredKey) {
@@ -94539,6 +94535,7 @@ function restoreImpl(stateProvider, earlyExit) {
9453994535
}
9454094536
}
9454194537
}
94538+
let hitFirstMatch = false;
9454294539
if (inputs.restorePrefixesFirstMatch.length > 0 &&
9454394540
!(lookedUpPrimaryKey && inputs.skipRestoreOnHitPrimaryKey)) {
9454494541
utils.info(`
@@ -94561,7 +94558,7 @@ function restoreImpl(stateProvider, earlyExit) {
9456194558
}
9456294559
else {
9456394560
utils.info(`Found a cache using the "${constants_1.Inputs.RestorePrefixesFirstMatch}".`);
94564-
core.setOutput(constants_1.Outputs.HitFirstMatch, true);
94561+
hitFirstMatch = true;
9456594562
restoredKey = yield restore.restoreCache(lookedUpFirstMatch);
9456694563
if (restoredKey) {
9456794564
restoredKeys.push(...[restoredKey]);
@@ -94575,10 +94572,12 @@ function restoreImpl(stateProvider, earlyExit) {
9457594572
if (!(lookedUpPrimaryKey && inputs.skipRestoreOnHitPrimaryKey)) {
9457694573
restoredKeys.push(...(yield restore.restoreAllMatches()));
9457794574
}
94578-
restoredKey || (restoredKey = "");
94575+
restoredKey !== null && restoredKey !== void 0 ? restoredKey : (restoredKey = "");
9457994576
// Store the matched cache key in states
9458094577
stateProvider.setState(constants_1.State.CacheRestoredKey, restoredKey);
94581-
core.setOutput(constants_1.Outputs.Hit, true);
94578+
core.setOutput(constants_1.Outputs.HitPrimaryKey, hitPrimaryKey);
94579+
core.setOutput(constants_1.Outputs.HitFirstMatch, hitFirstMatch);
94580+
core.setOutput(constants_1.Outputs.Hit, hitPrimaryKey || hitFirstMatch);
9458294581
core.setOutput(constants_1.Outputs.RestoredKey, restoredKey);
9458394582
core.setOutput(constants_1.Outputs.RestoredKeys, restoredKeys);
9458494583
return restoredKey;

0 commit comments

Comments
 (0)