2022-11-29 10:56:53 +00:00
|
|
|
import * as core from "@actions/core";
|
2020-03-18 13:35:13 +00:00
|
|
|
|
2022-12-02 10:14:43 +00:00
|
|
|
import { Inputs } from "./constants";
|
|
|
|
import run from "./restoreImpl";
|
2022-11-29 10:56:53 +00:00
|
|
|
import * as utils from "./utils/actionUtils";
|
|
|
|
|
2022-12-02 10:14:43 +00:00
|
|
|
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);
|
|
|
|
|
2022-12-02 10:14:43 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2022-12-02 10:14:43 +00:00
|
|
|
export default restore;
|