Skip to content

Commit e29dad3

Browse files
committed
Fix fail-on-cache-miss not working
1 parent ab5e6d0 commit e29dad3

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

dist/restore-only/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59392,7 +59392,7 @@ const core = __importStar(__nccwpck_require__(2186));
5939259392
const constants_1 = __nccwpck_require__(9042);
5939359393
const stateProvider_1 = __nccwpck_require__(1527);
5939459394
const utils = __importStar(__nccwpck_require__(6850));
59395-
function restoreImpl(stateProvider) {
59395+
function restoreImpl(stateProvider, earlyExit) {
5939659396
return __awaiter(this, void 0, void 0, function* () {
5939759397
try {
5939859398
if (!utils.isCacheFeatureAvailable()) {
@@ -59438,21 +59438,16 @@ function restoreImpl(stateProvider) {
5943859438
}
5943959439
catch (error) {
5944059440
core.setFailed(error.message);
59441+
if (earlyExit) {
59442+
process.exit(1);
59443+
}
5944159444
}
5944259445
});
5944359446
}
5944459447
exports.restoreImpl = restoreImpl;
5944559448
function run(stateProvider, earlyExit) {
5944659449
return __awaiter(this, void 0, void 0, function* () {
59447-
try {
59448-
yield restoreImpl(stateProvider);
59449-
}
59450-
catch (err) {
59451-
console.error(err);
59452-
if (earlyExit) {
59453-
process.exit(1);
59454-
}
59455-
}
59450+
yield restoreImpl(stateProvider, earlyExit);
5945659451
// node will stay alive if any promises are not resolved,
5945759452
// which is a possibility if HTTP requests are dangling
5945859453
// due to retries or timeouts. We know that if we got here

dist/restore/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59392,7 +59392,7 @@ const core = __importStar(__nccwpck_require__(2186));
5939259392
const constants_1 = __nccwpck_require__(9042);
5939359393
const stateProvider_1 = __nccwpck_require__(1527);
5939459394
const utils = __importStar(__nccwpck_require__(6850));
59395-
function restoreImpl(stateProvider) {
59395+
function restoreImpl(stateProvider, earlyExit) {
5939659396
return __awaiter(this, void 0, void 0, function* () {
5939759397
try {
5939859398
if (!utils.isCacheFeatureAvailable()) {
@@ -59438,21 +59438,16 @@ function restoreImpl(stateProvider) {
5943859438
}
5943959439
catch (error) {
5944059440
core.setFailed(error.message);
59441+
if (earlyExit) {
59442+
process.exit(1);
59443+
}
5944159444
}
5944259445
});
5944359446
}
5944459447
exports.restoreImpl = restoreImpl;
5944559448
function run(stateProvider, earlyExit) {
5944659449
return __awaiter(this, void 0, void 0, function* () {
59447-
try {
59448-
yield restoreImpl(stateProvider);
59449-
}
59450-
catch (err) {
59451-
console.error(err);
59452-
if (earlyExit) {
59453-
process.exit(1);
59454-
}
59455-
}
59450+
yield restoreImpl(stateProvider, earlyExit);
5945659451
// node will stay alive if any promises are not resolved,
5945759452
// which is a possibility if HTTP requests are dangling
5945859453
// due to retries or timeouts. We know that if we got here

src/restoreImpl.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
import * as utils from "./utils/actionUtils";
1111

1212
export async function restoreImpl(
13-
stateProvider: IStateProvider
13+
stateProvider: IStateProvider,
14+
earlyExit?: boolean | undefined
1415
): Promise<string | undefined> {
1516
try {
1617
if (!utils.isCacheFeatureAvailable()) {
@@ -83,21 +84,17 @@ export async function restoreImpl(
8384
return cacheKey;
8485
} catch (error: unknown) {
8586
core.setFailed((error as Error).message);
87+
if (earlyExit) {
88+
process.exit(1);
89+
}
8690
}
8791
}
8892

8993
async function run(
9094
stateProvider: IStateProvider,
9195
earlyExit: boolean | undefined
9296
): Promise<void> {
93-
try {
94-
await restoreImpl(stateProvider);
95-
} catch (err) {
96-
console.error(err);
97-
if (earlyExit) {
98-
process.exit(1);
99-
}
100-
}
97+
await restoreImpl(stateProvider, earlyExit);
10198

10299
// node will stay alive if any promises are not resolved,
103100
// which is a possibility if HTTP requests are dangling

0 commit comments

Comments
 (0)