From ef7eee951a0cc954e09d11185f48d5238829d465 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 13 Jun 2023 12:23:13 +0200 Subject: [PATCH] enable comments to avoid breaking change with current impl Signed-off-by: CrazyMax --- __tests__/context.test.ts | 19 ++++++++++++++++++- src/context.ts | 8 ++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/__tests__/context.test.ts b/__tests__/context.test.ts index 945345e..6adb020 100644 --- a/__tests__/context.test.ts +++ b/__tests__/context.test.ts @@ -63,7 +63,24 @@ describe('getInputs', () => { sepTags: ',', tags: [], } as Inputs - ] + ], + [ + 2, + new Map([ + ['images', 'moby/buildkit\n#comment\nghcr.io/moby/mbuildkit'], + ]), + { + context: ContextSource.workflow, + bakeTarget: 'docker-metadata-action', + flavor: [], + githubToken: '', + images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'], + labels: [], + sepLabels: '\n', + sepTags: '\n', + tags: [], + } as Inputs + ], ])( '[%d] given %p as inputs, returns %p', async (num: number, inputs: Map, expected: Inputs) => { diff --git a/src/context.ts b/src/context.ts index d4ac752..8907e56 100644 --- a/src/context.ts +++ b/src/context.ts @@ -19,10 +19,10 @@ export interface Inputs { export function getInputs(): Inputs { return { context: (core.getInput('context') || ContextSource.workflow) as ContextSource, - images: Util.getInputList('images', {ignoreComma: true}), - tags: Util.getInputList('tags', {ignoreComma: true}), - flavor: Util.getInputList('flavor', {ignoreComma: true}), - labels: Util.getInputList('labels', {ignoreComma: true}), + images: Util.getInputList('images', {ignoreComma: true, comment: '#'}), + tags: Util.getInputList('tags', {ignoreComma: true, comment: '#'}), + flavor: Util.getInputList('flavor', {ignoreComma: true, comment: '#'}), + labels: Util.getInputList('labels', {ignoreComma: true, comment: '#'}), sepTags: core.getInput('sep-tags', {trimWhitespace: false}) || `\n`, sepLabels: core.getInput('sep-labels', {trimWhitespace: false}) || `\n`, bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,