mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-26 08:28:28 +02:00
Send correct path(with name) to downloadArtifact function
This commit is contained in:
parent
8a017e9f5e
commit
820a073ccc
1 changed files with 5 additions and 4 deletions
|
@ -1,16 +1,17 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as artifact from '@actions/artifact'
|
import * as artifact from '@actions/artifact'
|
||||||
import {Inputs} from './constants'
|
import {Inputs} from './constants'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const name = core.getInput(Inputs.Name, {required: false})
|
const name = core.getInput(Inputs.Name, {required: false})
|
||||||
const path = core.getInput(Inputs.Path, {required: false})
|
const targetPath = core.getInput(Inputs.Path, {required: false})
|
||||||
|
|
||||||
const artifactClient = artifact.create()
|
const artifactClient = artifact.create()
|
||||||
if (!name) {
|
if (!name) {
|
||||||
// download all artifacts
|
// download all artifacts
|
||||||
const downloadResponse = await artifactClient.downloadAllArtifacts(path)
|
const downloadResponse = await artifactClient.downloadAllArtifacts(targetPath)
|
||||||
core.info(`There were ${downloadResponse.length} artifacts downloaded`)
|
core.info(`There were ${downloadResponse.length} artifacts downloaded`)
|
||||||
for (const artifact of downloadResponse) {
|
for (const artifact of downloadResponse) {
|
||||||
core.info(
|
core.info(
|
||||||
|
@ -20,11 +21,11 @@ async function run(): Promise<void> {
|
||||||
} else {
|
} else {
|
||||||
// download a single artifact
|
// download a single artifact
|
||||||
const downloadOptions = {
|
const downloadOptions = {
|
||||||
createArtifactFolder: true
|
createArtifactFolder: false
|
||||||
}
|
}
|
||||||
const downloadResponse = await artifactClient.downloadArtifact(
|
const downloadResponse = await artifactClient.downloadArtifact(
|
||||||
name,
|
name,
|
||||||
path,
|
path.join(targetPath, name),
|
||||||
downloadOptions
|
downloadOptions
|
||||||
)
|
)
|
||||||
core.info(
|
core.info(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue