mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 14:30:54 +00:00 
			
		
		
		
	Add fail-on-cache-miss option (#1036)
		
	* Add fail-on-cache-miss option * Small improvements * Changes after rebase * Update description * Only fail if no cache entry is found * Code review * Update readme * Add additional test case * Bump version + changelog * Update package-lock.json * Update Readme
This commit is contained in:
		
					parent
					
						
							
								8e3048d0f7
							
						
					
				
			
			
				commit
				
					
						627f0f41f6
					
				
			
		
					 15 changed files with 174 additions and 15 deletions
				
			
		
							
								
								
									
										7
									
								
								dist/restore/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								dist/restore/index.js
									
										
									
									
										vendored
									
									
								
							|  | @ -4978,7 +4978,8 @@ var Inputs; | |||
|     Inputs["Path"] = "path"; | ||||
|     Inputs["RestoreKeys"] = "restore-keys"; | ||||
|     Inputs["UploadChunkSize"] = "upload-chunk-size"; | ||||
|     Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive"; // Input for cache, restore, save action
 | ||||
|     Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive"; | ||||
|     Inputs["FailOnCacheMiss"] = "fail-on-cache-miss"; // Input for cache, restore action
 | ||||
| })(Inputs = exports.Inputs || (exports.Inputs = {})); | ||||
| var Outputs; | ||||
| (function (Outputs) { | ||||
|  | @ -50495,8 +50496,12 @@ function restoreImpl(stateProvider) { | |||
|                 required: true | ||||
|             }); | ||||
|             const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive); | ||||
|             const failOnCacheMiss = utils.getInputAsBool(constants_1.Inputs.FailOnCacheMiss); | ||||
|             const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, {}, enableCrossOsArchive); | ||||
|             if (!cacheKey) { | ||||
|                 if (failOnCacheMiss) { | ||||
|                     throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`); | ||||
|                 } | ||||
|                 core.info(`Cache not found for input keys: ${[ | ||||
|                     primaryKey, | ||||
|                     ...restoreKeys | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue