From 727cfbe442cea9109859b956b0673030139ebd36 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Thu, 24 Aug 2023 12:05:05 -0400 Subject: [PATCH] better fallback for path and append aritfact name for mutli-download --- dist/index.js | 5 ++++- src/download-artifact.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 085bbe4..4751c16 100644 --- a/dist/index.js +++ b/dist/index.js @@ -118700,6 +118700,9 @@ function run() { repository: core.getInput(constants_1.Inputs.Repository, { required: true }), runID: parseInt(core.getInput(constants_1.Inputs.RunID, { required: true })) }; + if (!inputs.path) { + inputs.path = process.env['GITHUB_WORKSPACE'] || process.cwd(); + } if (inputs.path.startsWith(`~`)) { inputs.path = inputs.path.replace('~', os.homedir()); } @@ -118728,7 +118731,7 @@ function run() { artifacts = listArtifactResponse.artifacts; } const downloadPromises = artifacts.map(artifact => artifactClient.downloadArtifact(artifact.id, owner, repo, inputs.token, { - path: resolvedPath + path: path.join(resolvedPath, artifact.name) })); const chunkedPromises = exports.chunk(downloadPromises, PARALLEL_DOWNLOADS); for (const chunk of chunkedPromises) { diff --git a/src/download-artifact.ts b/src/download-artifact.ts index def8738..2cdb916 100644 --- a/src/download-artifact.ts +++ b/src/download-artifact.ts @@ -22,6 +22,10 @@ async function run(): Promise { runID: parseInt(core.getInput(Inputs.RunID, {required: true})) } + if (!inputs.path) { + inputs.path = process.env['GITHUB_WORKSPACE'] || process.cwd() + } + if (inputs.path.startsWith(`~`)) { inputs.path = inputs.path.replace('~', os.homedir()) } @@ -77,7 +81,7 @@ async function run(): Promise { const downloadPromises = artifacts.map(artifact => artifactClient.downloadArtifact(artifact.id, owner, repo, inputs.token, { - path: resolvedPath + path: path.join(resolvedPath, artifact.name) }) )