1
mirror of https://github.com/actions/cache.git synced 2026-02-15 06:30:32 +00:00

adding wrapper to save-only and testcases

This commit is contained in:
Tanuj Kumar Mishra
2022-12-01 15:50:23 +00:00
parent a92fb881ae
commit 0685539942
7 changed files with 61622 additions and 77 deletions

View File

@@ -2,6 +2,7 @@ import * as cache from "@actions/cache";
import * as core from "@actions/core";
import { Events, Inputs, State } from "./constants";
import { saveOnly } from "./save-only";
import * as utils from "./utils/actionUtils";
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
@@ -28,7 +29,9 @@ async function run(): Promise<void> {
// Inputs are re-evaluted before the post action, so we want the original key used for restore
const primaryKey =
core.getState(State.CachePrimaryKey) || core.getInput(Inputs.Key);
saveOnly === true
? core.getInput(Inputs.Key)
: core.getState(State.CachePrimaryKey);
if (!primaryKey) {
utils.logWarning(`Error retrieving key from state.`);
@@ -58,6 +61,4 @@ async function run(): Promise<void> {
}
}
run();
export default run;