mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-06-08 23:41:17 +08:00
update save as well
This commit is contained in:
parent
d95c048983
commit
ac8fc97c06
12 changed files with 700 additions and 569 deletions
|
@ -2,10 +2,10 @@ import * as cache from "@actions/cache";
|
|||
import * as core from "@actions/core";
|
||||
|
||||
import { Events, Inputs, Outputs, State } from "./constants";
|
||||
import { IOutputSetter } from "./outputSetter";
|
||||
import { IStateProvider } from "./stateProvider";
|
||||
import * as utils from "./utils/actionUtils";
|
||||
|
||||
async function run(outputter: IOutputSetter): Promise<string | undefined> {
|
||||
async function restoreImpl(outputter: IStateProvider): Promise<string | undefined> {
|
||||
try {
|
||||
if (!utils.isCacheFeatureAvailable()) {
|
||||
utils.setCacheHitOutput(false);
|
||||
|
@ -48,15 +48,14 @@ async function run(outputter: IOutputSetter): Promise<string | undefined> {
|
|||
}
|
||||
|
||||
// Store the matched cache key in states
|
||||
//utils.setCacheState(cacheKey);
|
||||
outputter.setState(State.CacheMatchedKey, cacheKey);
|
||||
|
||||
const isExactKeyMatch = utils.isExactKeyMatch(
|
||||
core.getInput(Inputs.Key, { required: true }),
|
||||
cacheKey
|
||||
);
|
||||
//utils.setCacheHitOutput(isExactKeyMatch);
|
||||
outputter.setOutput(Outputs.CacheHit, isExactKeyMatch.toString());
|
||||
|
||||
core.setOutput(Outputs.CacheHit, isExactKeyMatch.toString());
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
|
||||
return cacheKey;
|
||||
|
@ -65,4 +64,4 @@ async function run(outputter: IOutputSetter): Promise<string | undefined> {
|
|||
}
|
||||
}
|
||||
|
||||
export default run;
|
||||
export default restoreImpl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue