Fix extra root extra root directory if downloading single artifact on v4-beta

konradpabjan/v4-beta-download-path
Konrad Pabjan 2023-10-26 21:37:41 -04:00
parent 896d1bb258
commit 54ed8ca4ec
2 changed files with 1556 additions and 1554 deletions

3105
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -40,10 +40,11 @@ async function run(): Promise<void> {
)
}
const isSingleArtifactDownload = !!inputs.name
const artifactClient = artifact.create()
let artifacts: artifact.Artifact[] = []
if (inputs.name) {
if (isSingleArtifactDownload) {
const {artifact: targetArtifact} = await artifactClient.getArtifact(
inputs.name,
inputs.runID,
@ -81,7 +82,7 @@ async function run(): Promise<void> {
const downloadPromises = artifacts.map(artifact =>
artifactClient.downloadArtifact(artifact.id, owner, repo, inputs.token, {
path: path.join(resolvedPath, artifact.name)
path: isSingleArtifactDownload? resolvedPath : path.join(resolvedPath, inputs.name)
})
)