From 3732f1d80009eaa47dc8220fb94cb227eb3867e4 Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Tue, 11 Aug 2020 22:44:28 -0600 Subject: [PATCH 1/4] allow skipping saving the layers --- action.yml | 6 +++++- post.ts | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e3dbbbfd..bd941d7a 100644 --- a/action.yml +++ b/action.yml @@ -11,13 +11,17 @@ inputs: required: true default: docker-layer-caching-${{ github.workflow }}-{hash} restore-keys: - description: An ordered list of keys to use for restoring the cache if no cache hit occurred for key + description: An ordered list of keys to use for restoring the cache if no cache hit occurred for key required: false default: docker-layer-caching-${{ github.workflow }}- concurrency: description: The number of concurrency when restoring and saving layers required: true default: '4' + skip-save: + description: Skip saving layers in the post step + required: false + default: false runs: using: node12 diff --git a/post.ts b/post.ts index 09593358..601b78e5 100644 --- a/post.ts +++ b/post.ts @@ -5,6 +5,11 @@ import { LayerCache } from './src/LayerCache' import { ImageDetector } from './src/ImageDetector' import { assertType } from 'typescript-is' const main = async () => { + if (core.getInput('skip-save')) { + core.info('Skipping save.') + return + } + const primaryKey = core.getInput('key', { required: true }) const restoredKey = JSON.parse(core.getState(`restored-key`)) as string From 14fa3d606056a85f20feddd1ee56b4d355a2dd6d Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Tue, 11 Aug 2020 22:51:07 -0600 Subject: [PATCH 2/4] fix always string input --- action.yml | 1 - post.ts | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index bd941d7a..69178270 100644 --- a/action.yml +++ b/action.yml @@ -21,7 +21,6 @@ inputs: skip-save: description: Skip saving layers in the post step required: false - default: false runs: using: node12 diff --git a/post.ts b/post.ts index 601b78e5..2a79699a 100644 --- a/post.ts +++ b/post.ts @@ -4,8 +4,9 @@ import exec from 'actions-exec-listener' import { LayerCache } from './src/LayerCache' import { ImageDetector } from './src/ImageDetector' import { assertType } from 'typescript-is' + const main = async () => { - if (core.getInput('skip-save')) { + if (core.getInput('skip-save') != null) { core.info('Skipping save.') return } From ae6e6fc9be0dd5f7291e235a8a706007ae7cf1fc Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Fri, 14 Aug 2020 11:07:34 -0600 Subject: [PATCH 3/4] Update action.yml Co-authored-by: satackey --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 69178270..1a822ea9 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,7 @@ inputs: skip-save: description: Skip saving layers in the post step required: false + default: 'false' runs: using: node12 From d5e9713abfb2dfb8dcb37f1e55810e3c014528d3 Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Fri, 14 Aug 2020 11:07:44 -0600 Subject: [PATCH 4/4] Update post.ts Co-authored-by: satackey --- post.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post.ts b/post.ts index 2a79699a..529e8f2d 100644 --- a/post.ts +++ b/post.ts @@ -6,7 +6,7 @@ import { ImageDetector } from './src/ImageDetector' import { assertType } from 'typescript-is' const main = async () => { - if (core.getInput('skip-save') != null) { + if (JSON.parse(core.getInput('skip-save', { required: true }))) { core.info('Skipping save.') return }