mirror of
				https://github.com/actions/cache.git
				synced 2025-10-23 08:56:26 +08:00 
			
		
		
		
	refactor into a generic outputter
This commit is contained in:
		| @@ -1,22 +1,8 @@ | ||||
| import * as core from "@actions/core"; | ||||
|  | ||||
| import { Inputs } from "./constants"; | ||||
| import { StateOutputSetter } from "./outputSetter"; | ||||
| 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}`); | ||||
|     } | ||||
|     await run(new StateOutputSetter()); | ||||
| } | ||||
|  | ||||
| export default restore; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user