From 2807da784fd5c6b7707c0ad2a98a5376c199f496 Mon Sep 17 00:00:00 2001 From: Vincent Clemson Date: Sat, 18 Jun 2022 17:50:09 -0400 Subject: [PATCH] fix `needs` option for `test-only-restore` job * also format code with prettier --- .github/workflows/workflow.yml | 2 +- src/save.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 2ba59e9..138da32 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -72,7 +72,7 @@ jobs: test-cache ~/test-cache test-only-restore: - needs: test-restore + needs: test-save strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] diff --git a/src/save.ts b/src/save.ts index 1644b8b..d37a086 100644 --- a/src/save.ts +++ b/src/save.ts @@ -10,13 +10,13 @@ import * as utils from "./utils/actionUtils"; process.on("uncaughtException", e => utils.logWarning(e.message)); async function run(): Promise { - const save = ! core.getBooleanInput(Inputs.OnlyRestore); + const save = !core.getBooleanInput(Inputs.OnlyRestore); if (save) { try { if (!utils.isCacheFeatureAvailable()) { return; } - + if (!utils.isValidEvent()) { utils.logWarning( `Event Validation Error: The event type ${ @@ -25,27 +25,27 @@ async function run(): Promise { ); return; } - + const state = utils.getCacheState(); - + // Inputs are re-evaluted before the post action, so we want the original key used for restore const primaryKey = core.getState(State.CachePrimaryKey); if (!primaryKey) { utils.logWarning(`Error retrieving key from state.`); return; } - + if (utils.isExactKeyMatch(primaryKey, state)) { core.info( `Cache hit occurred on the primary key ${primaryKey}, not saving cache.` ); return; } - + const cachePaths = utils.getInputAsArray(Inputs.Path, { required: true }); - + try { await cache.saveCache(cachePaths, primaryKey, { uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)