mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 18:34:19 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			631 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			631 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import * as core from "@actions/core";
 | |
| 
 | |
| import { Inputs } from "./constants";
 | |
| import run from "./restoreImpl";
 | |
| import * as utils from "./utils/actionUtils";
 | |
| 
 | |
| async function restore(): Promise<void> {
 | |
|     const cacheKey = await run();
 | |
|     if (cacheKey) {
 | |
|         // Store the matched cache key in states
 | |
|         utils.setCacheState(cacheKey);
 | |
| 
 | |
|         const isExactKeyMatch = utils.isExactKeyMatch(
 | |
|             core.getInput(Inputs.Key, { required: true }),
 | |
|             cacheKey
 | |
|         );
 | |
|         utils.setCacheHitOutput(isExactKeyMatch);
 | |
|         core.info(`Cache restored from key: ${cacheKey}`);
 | |
|     }
 | |
| }
 | |
| 
 | |
| export default restore;
 | 
