From 07ab29fd4a977ae4d2b275087cf67563dfdf0295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Str=C3=B6hlein?= <39571859+timostroehlein@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:51:41 +0100 Subject: [PATCH] add merge_multiple option (#327) --- action.yml | 4 ++++ main.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 915f64f4..551d02ff 100644 --- a/action.yml +++ b/action.yml @@ -92,6 +92,10 @@ inputs: description: Use system provided `unzip` utility instead of JS library for unpacking required: false default: false + merge_multiple: + description: If multiple artifacts are found with `name_is_regexp` set to `true`, merge them into one directory + required: false + default: false outputs: error_message: description: The error message, if an error occurs diff --git a/main.js b/main.js index d2eafd89..7a26b0e2 100644 --- a/main.js +++ b/main.js @@ -39,6 +39,7 @@ async function main() { const skipUnpack = core.getBooleanInput("skip_unpack") const ifNoArtifactFound = core.getInput("if_no_artifact_found") const useUnzip = core.getBooleanInput("use_unzip") + const mergeMultiple = core.getBooleanInput("merge_multiple") let workflow = core.getInput("workflow") let workflowSearch = core.getBooleanInput("workflow_search") let workflowConclusion = core.getInput("workflow_conclusion") @@ -268,7 +269,7 @@ async function main() { continue } - const dir = name && !nameIsRegExp ? path : pathname.join(path, artifact.name) + const dir = name && (!nameIsRegExp || mergeMultiple) ? path : pathname.join(path, artifact.name) fs.mkdirSync(dir, { recursive: true })