mirror of
https://github.com/actions/download-artifact.git
synced 2024-11-22 05:35:29 +00:00
Revert "[v4 beta] Fixes to download directory structure (#233)"
This reverts commit 88dadfbcfc
.
This commit is contained in:
parent
88dadfbcfc
commit
5333e349ab
@ -25,5 +25,5 @@ outputs:
|
||||
download-path:
|
||||
description: 'Path of artifact download'
|
||||
runs:
|
||||
using: 'node20'
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
|
7
dist/index.js
vendored
7
dist/index.js
vendored
@ -118706,7 +118706,6 @@ function run() {
|
||||
if (inputs.path.startsWith(`~`)) {
|
||||
inputs.path = inputs.path.replace('~', os.homedir());
|
||||
}
|
||||
const isSingleArtifactDownload = !!inputs.name;
|
||||
const resolvedPath = path.resolve(inputs.path);
|
||||
core.debug(`Resolved path is ${resolvedPath}`);
|
||||
const [owner, repo] = inputs.repository.split('/');
|
||||
@ -118715,8 +118714,7 @@ function run() {
|
||||
}
|
||||
const artifactClient = artifact.create();
|
||||
let artifacts = [];
|
||||
if (isSingleArtifactDownload) {
|
||||
core.info(`Downloading single artifact`);
|
||||
if (inputs.name) {
|
||||
const { artifact: targetArtifact } = yield artifactClient.getArtifact(inputs.name, inputs.runID, owner, repo, inputs.token);
|
||||
if (!targetArtifact) {
|
||||
throw new Error(`Artifact '${inputs.name}' not found`);
|
||||
@ -118725,7 +118723,6 @@ function run() {
|
||||
artifacts = [targetArtifact];
|
||||
}
|
||||
else {
|
||||
core.info(`No input name specified, downloading all artifacts. Extra directory with the artifact name will be created for each download`);
|
||||
const listArtifactResponse = yield artifactClient.listArtifacts(inputs.runID, owner, repo, inputs.token);
|
||||
if (listArtifactResponse.artifacts.length === 0) {
|
||||
throw new Error(`No artifacts found for run '${inputs.runID}' in '${inputs.repository}'`);
|
||||
@ -118734,7 +118731,7 @@ function run() {
|
||||
artifacts = listArtifactResponse.artifacts;
|
||||
}
|
||||
const downloadPromises = artifacts.map(artifact => artifactClient.downloadArtifact(artifact.id, owner, repo, inputs.token, {
|
||||
path: isSingleArtifactDownload ? resolvedPath : path.join(resolvedPath, artifact.name)
|
||||
path: path.join(resolvedPath, artifact.name)
|
||||
}));
|
||||
const chunkedPromises = exports.chunk(downloadPromises, PARALLEL_DOWNLOADS);
|
||||
for (const chunk of chunkedPromises) {
|
||||
|
@ -30,7 +30,6 @@ async function run(): Promise<void> {
|
||||
inputs.path = inputs.path.replace('~', os.homedir())
|
||||
}
|
||||
|
||||
const isSingleArtifactDownload: boolean = !!inputs.name
|
||||
const resolvedPath = path.resolve(inputs.path)
|
||||
core.debug(`Resolved path is ${resolvedPath}`)
|
||||
|
||||
@ -44,9 +43,7 @@ async function run(): Promise<void> {
|
||||
const artifactClient = artifact.create()
|
||||
let artifacts: artifact.Artifact[] = []
|
||||
|
||||
if (isSingleArtifactDownload) {
|
||||
core.info(`Downloading single artifact`)
|
||||
|
||||
if (inputs.name) {
|
||||
const {artifact: targetArtifact} = await artifactClient.getArtifact(
|
||||
inputs.name,
|
||||
inputs.runID,
|
||||
@ -65,8 +62,6 @@ async function run(): Promise<void> {
|
||||
|
||||
artifacts = [targetArtifact]
|
||||
} else {
|
||||
core.info(`No input name specified, downloading all artifacts. Extra directory with the artifact name will be created for each download`)
|
||||
|
||||
const listArtifactResponse = await artifactClient.listArtifacts(
|
||||
inputs.runID,
|
||||
owner,
|
||||
@ -86,7 +81,7 @@ async function run(): Promise<void> {
|
||||
|
||||
const downloadPromises = artifacts.map(artifact =>
|
||||
artifactClient.downloadArtifact(artifact.id, owner, repo, inputs.token, {
|
||||
path: isSingleArtifactDownload ? resolvedPath : path.join(resolvedPath, artifact.name)
|
||||
path: path.join(resolvedPath, artifact.name)
|
||||
})
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user