mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 13:29:10 +08: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:
		
							
								
								
									
										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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user