cache/src/restore.ts

23 lines
631 B
TypeScript
Raw Normal View History

2022-11-29 10:56:53 +00:00
import * as core from "@actions/core";
import { Inputs } from "./constants";
import run from "./restoreImpl";
2022-11-29 10:56:53 +00:00
import * as utils from "./utils/actionUtils";
async function restore(): Promise<void> {
const cacheKey = await run();
if (cacheKey) {
// Store the matched cache key in states
2022-11-29 10:56:53 +00:00
utils.setCacheState(cacheKey);
const isExactKeyMatch = utils.isExactKeyMatch(
core.getInput(Inputs.Key, { required: true }),
cacheKey
);
2022-11-29 10:56:53 +00:00
utils.setCacheHitOutput(isExactKeyMatch);
core.info(`Cache restored from key: ${cacheKey}`);
}
2019-10-30 18:48:49 +00:00
}
export default restore;