From 13137a8f9b8fce39074a26add97e20b25f0b80fc Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 5 Dec 2020 03:40:39 +0100 Subject: [PATCH] Trim input list items Signed-off-by: CrazyMax --- __tests__/context.test.ts | 15 +++++++++++++++ dist/index.js | 2 +- src/context.ts | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/__tests__/context.test.ts b/__tests__/context.test.ts index 33ee960..5352f81 100644 --- a/__tests__/context.test.ts +++ b/__tests__/context.test.ts @@ -166,6 +166,21 @@ describe('getArgs', () => { 'https://github.com/docker/build-push-action.git#test-jest' ] ], + [ + '0.4.2', + new Map([ + ['tags', 'name/app:7.4, name/app:latest'], + ]), + [ + 'buildx', + 'build', + '--tag', 'name/app:7.4', + '--tag', 'name/app:latest', + '--iidfile', '/tmp/.docker-build-push-jest/iidfile', + '--file', 'Dockerfile', + 'https://github.com/docker/build-push-action.git#test-jest' + ] + ], [ '0.4.2', new Map([ diff --git a/dist/index.js b/dist/index.js index a6a2974..df76d49 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12266,7 +12266,7 @@ function getInputList(name, ignoreComma) { } res.push(output.join(',')); } - return res.filter(item => item); + return res.filter(item => item).map(pat => pat.trim()); }); } exports.getInputList = getInputList; diff --git a/src/context.ts b/src/context.ts index f62f2b8..e23521f 100644 --- a/src/context.ts +++ b/src/context.ts @@ -183,7 +183,7 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise res.push(output.join(',')); } - return res.filter(item => item); + return res.filter(item => item).map(pat => pat.trim()); } export const asyncForEach = async (array, callback) => {