From aef6ecca6cc3bbc44762418fbd038cc8586d2fa1 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Fri, 31 Mar 2023 08:27:15 +0200 Subject: [PATCH] Add cache-restore-only input --- action.yml | 3 +++ dist/cache-save/index.js | 3 ++- src/cache-save.ts | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index e3a21c1..50e2d5e 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,9 @@ inputs: default: true cache-dependency-path: description: 'Used to specify the path to a dependency file - go.sum' + cache-restore-only: + description: 'Set this option to true if you do not want to modify the cache from the previous build' + default: false architecture: description: 'Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default.' outputs: diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 8775623..95bcbec 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -60363,7 +60363,8 @@ function run() { exports.run = run; const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { const cacheInput = core.getBooleanInput('cache'); - if (!cacheInput) { + const cacheRestoreOnly = core.getBooleanInput('cache-restore-only'); + if (!cacheInput || cacheRestoreOnly) { return; } const packageManager = 'default'; diff --git a/src/cache-save.ts b/src/cache-save.ts index 584d0a6..ee633be 100644 --- a/src/cache-save.ts +++ b/src/cache-save.ts @@ -29,7 +29,8 @@ export async function run() { const cachePackages = async () => { const cacheInput = core.getBooleanInput('cache'); - if (!cacheInput) { + const cacheRestoreOnly = core.getBooleanInput('cache-restore-only'); + if (!cacheInput || cacheRestoreOnly) { return; }