From 015084af5805c3a4875d87064153870dc3e9ef1f Mon Sep 17 00:00:00 2001 From: Edoardo Pirovano Date: Tue, 9 Aug 2022 15:11:47 +0100 Subject: [PATCH] Add option to skip uploading of cache --- action.yml | 4 ++++ dist/restore/index.js | 1 + dist/save/index.js | 4 ++++ src/constants.ts | 3 ++- src/save.ts | 6 ++++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 3e158e3..fa600ab 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,10 @@ inputs: upload-chunk-size: description: 'The chunk size used to split up large files during upload, in bytes' required: false + skip-upload: + description: 'Set this to true to skip uploading the cache at the end even if we got a miss' + required: false + default: 'false' outputs: cache-hit: description: 'A boolean value to indicate an exact match was found for the primary key' diff --git a/dist/restore/index.js b/dist/restore/index.js index dea79fc..4499d8a 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -4616,6 +4616,7 @@ var Inputs; Inputs["Path"] = "path"; Inputs["RestoreKeys"] = "restore-keys"; Inputs["UploadChunkSize"] = "upload-chunk-size"; + Inputs["SkipUpload"] = "skip-upload"; })(Inputs = exports.Inputs || (exports.Inputs = {})); var Outputs; (function (Outputs) { diff --git a/dist/save/index.js b/dist/save/index.js index 4236eee..5dd1e61 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -4616,6 +4616,7 @@ var Inputs; Inputs["Path"] = "path"; Inputs["RestoreKeys"] = "restore-keys"; Inputs["UploadChunkSize"] = "upload-chunk-size"; + Inputs["SkipUpload"] = "skip-upload"; })(Inputs = exports.Inputs || (exports.Inputs = {})); var Outputs; (function (Outputs) { @@ -46795,6 +46796,9 @@ function run() { core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); return; } + if (core.getBooleanInput(constants_1.Inputs.SkipUpload)) { + core.info(`Skipping upload of cache since the skip-upload input was set.`); + } const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, { required: true }); diff --git a/src/constants.ts b/src/constants.ts index 133f47d..d3672c0 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,7 +2,8 @@ export enum Inputs { Key = "key", Path = "path", RestoreKeys = "restore-keys", - UploadChunkSize = "upload-chunk-size" + UploadChunkSize = "upload-chunk-size", + SkipUpload = "skip-upload" } export enum Outputs { diff --git a/src/save.ts b/src/save.ts index a0a21bf..2e8304d 100644 --- a/src/save.ts +++ b/src/save.ts @@ -40,6 +40,12 @@ async function run(): Promise { return; } + if (core.getBooleanInput(Inputs.SkipUpload)) { + core.info( + `Skipping upload of cache since the skip-upload input was set.` + ); + } + const cachePaths = utils.getInputAsArray(Inputs.Path, { required: true });