From 2338d4f20178da52f88753ccecf8318afce5aac8 Mon Sep 17 00:00:00 2001 From: leechechik Date: Wed, 29 Apr 2020 15:50:28 +0300 Subject: [PATCH] use the name as the path, if path is null --- src/download-artifact.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/download-artifact.ts b/src/download-artifact.ts index 9619347..9da57ce 100644 --- a/src/download-artifact.ts +++ b/src/download-artifact.ts @@ -1,17 +1,16 @@ import * as core from '@actions/core' import * as artifact from '@actions/artifact' import {Inputs} from './constants' -import * as path from 'path' async function run(): Promise { try { const name = core.getInput(Inputs.Name, {required: false}) - const targetPath = core.getInput(Inputs.Path, {required: false}) + const path = core.getInput(Inputs.Path, {required: false}) const artifactClient = artifact.create() if (!name) { // download all artifacts - const downloadResponse = await artifactClient.downloadAllArtifacts(targetPath) + const downloadResponse = await artifactClient.downloadAllArtifacts(path) core.info(`There were ${downloadResponse.length} artifacts downloaded`) for (const artifact of downloadResponse) { core.info( @@ -23,9 +22,10 @@ async function run(): Promise { const downloadOptions = { createArtifactFolder: true } + const targetPath = !path ? name : path; const downloadResponse = await artifactClient.downloadArtifact( name, - path.join(targetPath, name), + targetPath, downloadOptions ) core.info(