From ac50dab596e81527a3eb54c083984774ed4daa50 Mon Sep 17 00:00:00 2001 From: Quentin Dreyer Date: Tue, 20 Aug 2024 17:13:56 +0200 Subject: [PATCH] fix: correctly handle parallel downloading --- src/download-artifact.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/download-artifact.ts b/src/download-artifact.ts index aedfe12..967fe66 100644 --- a/src/download-artifact.ts +++ b/src/download-artifact.ts @@ -111,7 +111,7 @@ async function run(): Promise { }) } - const downloadPromises = artifacts.map(artifact => + const downloadPromises = artifacts.map(artifact => () => artifactClient.downloadArtifact(artifact.id, { ...options, path: @@ -123,7 +123,7 @@ async function run(): Promise { const chunkedPromises = chunk(downloadPromises, PARALLEL_DOWNLOADS) for (const chunk of chunkedPromises) { - await Promise.all(chunk) + await Promise.all(chunk.map(fn => fn())) } core.info(`Total of ${artifacts.length} artifact(s) downloaded`)