mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 13:29:10 +08:00 
			
		
		
		
	Fix cache-hit output when cache missed (#1404)
* fix: cache-hit output * fix: Output chache hit timing * fix: Output chache hit timing --------- Co-authored-by: Josh Gross <joshmgross@github.com>
This commit is contained in:
		
							
								
								
									
										1
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							@@ -59415,6 +59415,7 @@ function restoreImpl(stateProvider, earlyExit) {
 | 
			
		||||
            const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
 | 
			
		||||
            const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
 | 
			
		||||
            if (!cacheKey) {
 | 
			
		||||
                core.setOutput(constants_1.Outputs.CacheHit, false.toString());
 | 
			
		||||
                if (failOnCacheMiss) {
 | 
			
		||||
                    throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							@@ -59415,6 +59415,7 @@ function restoreImpl(stateProvider, earlyExit) {
 | 
			
		||||
            const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
 | 
			
		||||
            const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
 | 
			
		||||
            if (!cacheKey) {
 | 
			
		||||
                core.setOutput(constants_1.Outputs.CacheHit, false.toString());
 | 
			
		||||
                if (failOnCacheMiss) {
 | 
			
		||||
                    throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user