mirror of
				https://github.com/Swatinem/rust-cache.git
				synced 2025-10-31 19:33:48 +00:00 
			
		
		
		
	Add support for the cache-hit output
				
					
				
			This commit is contained in:
		
							parent
							
								
									be44a3e6ff
								
							
						
					
					
						commit
						27793b3b80
					
				| @ -11,6 +11,9 @@ inputs: | ||||
|   working-directory: | ||||
|     description: "The working directory this action should operate in" | ||||
|     required: false | ||||
| outputs: | ||||
|   cache-hit: | ||||
|     description: 'A boolean value that indicates an exact match was found' | ||||
| runs: | ||||
|   using: "node12" | ||||
|   main: "dist/restore/index.js" | ||||
|  | ||||
| @ -22,12 +22,22 @@ async function run() { | ||||
| 
 | ||||
|         await cleanTarget(packages); | ||||
|       } | ||||
| 
 | ||||
|       setCacheHitOutput(restoreKey === key); | ||||
|     } else { | ||||
|       core.info("No cache found."); | ||||
| 
 | ||||
|       setCacheHitOutput(false); | ||||
|     } | ||||
|   } catch (e) { | ||||
|     setCacheHitOutput(false); | ||||
| 
 | ||||
|     core.info(`[warning] ${e.message}`); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| function setCacheHitOutput(cacheHit: boolean): void { | ||||
|   core.setOutput("cache-hit", cacheHit.toString()); | ||||
| } | ||||
| 
 | ||||
| run(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user