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