1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-11-28 23:19:16 +01:00
cache/src/restore.ts

23 lines
631 B
TypeScript
Raw Normal View History

2022-11-29 11:56:53 +01:00
import * as core from "@actions/core";
import { Inputs } from "./constants";
import run from "./restoreImpl";
2022-11-29 11:56:53 +01: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 11:56:53 +01:00
utils.setCacheState(cacheKey);
const isExactKeyMatch = utils.isExactKeyMatch(
core.getInput(Inputs.Key, { required: true }),
cacheKey
);
2022-11-29 11:56:53 +01:00
utils.setCacheHitOutput(isExactKeyMatch);
core.info(`Cache restored from key: ${cacheKey}`);
}
2019-10-30 19:48:49 +01:00
}
export default restore;