mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 15:26:24 +07:00 
			
		
		
		
	Fix fail-on-cache-miss not working
This commit is contained in:
		
							
								
								
									
										15
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							| @ -59392,7 +59392,7 @@ const core = __importStar(__nccwpck_require__(2186)); | |||||||
| const constants_1 = __nccwpck_require__(9042); | const constants_1 = __nccwpck_require__(9042); | ||||||
| const stateProvider_1 = __nccwpck_require__(1527); | const stateProvider_1 = __nccwpck_require__(1527); | ||||||
| const utils = __importStar(__nccwpck_require__(6850)); | const utils = __importStar(__nccwpck_require__(6850)); | ||||||
| function restoreImpl(stateProvider) { | function restoreImpl(stateProvider, earlyExit) { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         try { | ||||||
|             if (!utils.isCacheFeatureAvailable()) { |             if (!utils.isCacheFeatureAvailable()) { | ||||||
| @ -59438,21 +59438,16 @@ function restoreImpl(stateProvider) { | |||||||
|         } |         } | ||||||
|         catch (error) { |         catch (error) { | ||||||
|             core.setFailed(error.message); |             core.setFailed(error.message); | ||||||
|  |             if (earlyExit) { | ||||||
|  |                 process.exit(1); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| exports.restoreImpl = restoreImpl; | exports.restoreImpl = restoreImpl; | ||||||
| function run(stateProvider, earlyExit) { | function run(stateProvider, earlyExit) { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         yield restoreImpl(stateProvider, earlyExit); | ||||||
|             yield restoreImpl(stateProvider); |  | ||||||
|         } |  | ||||||
|         catch (err) { |  | ||||||
|             console.error(err); |  | ||||||
|             if (earlyExit) { |  | ||||||
|                 process.exit(1); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         // node will stay alive if any promises are not resolved,
 |         // node will stay alive if any promises are not resolved,
 | ||||||
|         // which is a possibility if HTTP requests are dangling
 |         // which is a possibility if HTTP requests are dangling
 | ||||||
|         // due to retries or timeouts. We know that if we got here
 |         // due to retries or timeouts. We know that if we got here
 | ||||||
|  | |||||||
							
								
								
									
										15
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @ -59392,7 +59392,7 @@ const core = __importStar(__nccwpck_require__(2186)); | |||||||
| const constants_1 = __nccwpck_require__(9042); | const constants_1 = __nccwpck_require__(9042); | ||||||
| const stateProvider_1 = __nccwpck_require__(1527); | const stateProvider_1 = __nccwpck_require__(1527); | ||||||
| const utils = __importStar(__nccwpck_require__(6850)); | const utils = __importStar(__nccwpck_require__(6850)); | ||||||
| function restoreImpl(stateProvider) { | function restoreImpl(stateProvider, earlyExit) { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         try { | ||||||
|             if (!utils.isCacheFeatureAvailable()) { |             if (!utils.isCacheFeatureAvailable()) { | ||||||
| @ -59438,21 +59438,16 @@ function restoreImpl(stateProvider) { | |||||||
|         } |         } | ||||||
|         catch (error) { |         catch (error) { | ||||||
|             core.setFailed(error.message); |             core.setFailed(error.message); | ||||||
|  |             if (earlyExit) { | ||||||
|  |                 process.exit(1); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| exports.restoreImpl = restoreImpl; | exports.restoreImpl = restoreImpl; | ||||||
| function run(stateProvider, earlyExit) { | function run(stateProvider, earlyExit) { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         yield restoreImpl(stateProvider, earlyExit); | ||||||
|             yield restoreImpl(stateProvider); |  | ||||||
|         } |  | ||||||
|         catch (err) { |  | ||||||
|             console.error(err); |  | ||||||
|             if (earlyExit) { |  | ||||||
|                 process.exit(1); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         // node will stay alive if any promises are not resolved,
 |         // node will stay alive if any promises are not resolved,
 | ||||||
|         // which is a possibility if HTTP requests are dangling
 |         // which is a possibility if HTTP requests are dangling
 | ||||||
|         // due to retries or timeouts. We know that if we got here
 |         // due to retries or timeouts. We know that if we got here
 | ||||||
|  | |||||||
| @ -10,7 +10,8 @@ import { | |||||||
| import * as utils from "./utils/actionUtils"; | import * as utils from "./utils/actionUtils"; | ||||||
|  |  | ||||||
| export async function restoreImpl( | export async function restoreImpl( | ||||||
|     stateProvider: IStateProvider |     stateProvider: IStateProvider, | ||||||
|  |     earlyExit?: boolean | undefined | ||||||
| ): Promise<string | undefined> { | ): Promise<string | undefined> { | ||||||
|     try { |     try { | ||||||
|         if (!utils.isCacheFeatureAvailable()) { |         if (!utils.isCacheFeatureAvailable()) { | ||||||
| @ -83,6 +84,9 @@ export async function restoreImpl( | |||||||
|         return cacheKey; |         return cacheKey; | ||||||
|     } catch (error: unknown) { |     } catch (error: unknown) { | ||||||
|         core.setFailed((error as Error).message); |         core.setFailed((error as Error).message); | ||||||
|  |         if (earlyExit) { | ||||||
|  |             process.exit(1); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -90,14 +94,7 @@ async function run( | |||||||
|     stateProvider: IStateProvider, |     stateProvider: IStateProvider, | ||||||
|     earlyExit: boolean | undefined |     earlyExit: boolean | undefined | ||||||
| ): Promise<void> { | ): Promise<void> { | ||||||
|     try { |     await restoreImpl(stateProvider, earlyExit); | ||||||
|         await restoreImpl(stateProvider); |  | ||||||
|     } catch (err) { |  | ||||||
|         console.error(err); |  | ||||||
|         if (earlyExit) { |  | ||||||
|             process.exit(1); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // node will stay alive if any promises are not resolved, |     // node will stay alive if any promises are not resolved, | ||||||
|     // which is a possibility if HTTP requests are dangling |     // which is a possibility if HTTP requests are dangling | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Marc Mueller
					Marc Mueller