From 0e2f65cc20f94346f1ab8f78191431cc9c017041 Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Wed, 8 Nov 2023 14:13:16 +0100 Subject: [PATCH] fix: ensure imageNames are not empty strings In Typescript/Javascript an empty string split on newline is going to produce an array with an empty string. => "".split('\n') [""] This causes the action to produce a warning, unless `pull-images` is set to false. Failed to get dockerfile path for image : Error: The process '/usr/bin/docker' failed with exit code 1 Filtering the list to remove any zero-length strings from the array solves this issue. Signed-off-by: Morten Linderud --- src/utilities/dockerUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utilities/dockerUtils.ts b/src/utilities/dockerUtils.ts index 3599a3643..1064509ac 100644 --- a/src/utilities/dockerUtils.ts +++ b/src/utilities/dockerUtils.ts @@ -23,7 +23,11 @@ export async function getDeploymentConfig(): Promise { ) } - const imageNames = core.getInput('images').split('\n') || [] + const imageNames = + core + .getInput('images') + .split('\n') + .filter((image) => image.length > 0) || [] const imageDockerfilePathMap: {[id: string]: string} = {} const pullImages = !(core.getInput('pull-images').toLowerCase() === 'false')