mirror of
				https://github.com/actions/cache.git
				synced 2025-10-30 02:18:37 +08:00 
			
		
		
		
	fix: Output chache hit timing
This commit is contained in:
		
							parent
							
								
									688d5d4688
								
							
						
					
					
						commit
						6f5b5ee729
					
				|  | @ -260,7 +260,7 @@ test("Fail restore when fail on cache miss is enabled and primary + restore keys | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); |     expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); | ||||||
|     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(0); |     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); | ||||||
| 
 | 
 | ||||||
|     expect(failedMock).toHaveBeenCalledWith( |     expect(failedMock).toHaveBeenCalledWith( | ||||||
|         `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${key}` |         `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${key}` | ||||||
|  |  | ||||||
|  | @ -51,6 +51,7 @@ export async function restoreImpl( | ||||||
|         ); |         ); | ||||||
| 
 | 
 | ||||||
|         if (!cacheKey) { |         if (!cacheKey) { | ||||||
|  |             core.setOutput(Outputs.CacheHit, false.toString()); | ||||||
|             if (failOnCacheMiss) { |             if (failOnCacheMiss) { | ||||||
|                 throw new Error( |                 throw new Error( | ||||||
|                     `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}` |                     `Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}` | ||||||
|  | @ -62,7 +63,6 @@ export async function restoreImpl( | ||||||
|                     ...restoreKeys |                     ...restoreKeys | ||||||
|                 ].join(", ")}` |                 ].join(", ")}` | ||||||
|             ); |             ); | ||||||
|             core.setOutput(Outputs.CacheHit, false.toString()); |  | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Ryo Mimura
						Ryo Mimura