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