mirror of
https://github.com/actions/download-artifact.git
synced 2025-11-02 01:33:41 +00:00
use the name as the path, if path is null
This commit is contained in:
parent
0904f6d934
commit
2338d4f201
@ -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<void> {
|
||||
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<void> {
|
||||
const downloadOptions = {
|
||||
createArtifactFolder: true
|
||||
}
|
||||
const targetPath = !path ? name : path;
|
||||
const downloadResponse = await artifactClient.downloadArtifact(
|
||||
name,
|
||||
path.join(targetPath, name),
|
||||
targetPath,
|
||||
downloadOptions
|
||||
)
|
||||
core.info(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user