mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-17 20:18:28 +02:00
revert getArtifact()
changes - for now we have to list and filter by artifact-ids until a getArtifactById()
public method exists
This commit is contained in:
parent
b83057b90d
commit
54124fbd88
3 changed files with 11 additions and 213 deletions
19
dist/index.js
vendored
19
dist/index.js
vendored
|
@ -118845,22 +118845,9 @@ function run() {
|
|||
}
|
||||
return numericId;
|
||||
});
|
||||
// if the length of artifactIds exactly 1 fetch the latest artifact by its name and check the ID
|
||||
if (artifactIds.length === 1) {
|
||||
core.debug(`Only one artifact ID provided. Fetching latest artifact by its name and checking the ID`);
|
||||
const { artifact: targetArtifact } = yield artifact_1.default.getArtifact(inputs.name, options);
|
||||
if (!targetArtifact) {
|
||||
throw new Error(`Artifact with ID '${artifactIds[0]}' not found. Please check the ID.`);
|
||||
}
|
||||
core.debug(`Found artifact by ID '${targetArtifact.name}' (ID: ${targetArtifact.id}, Size: ${targetArtifact.size})`);
|
||||
artifacts = [targetArtifact];
|
||||
}
|
||||
else {
|
||||
core.info(`Multiple artifact IDs provided. Fetching all artifacts to filter by ID`);
|
||||
// We need to fetch all artifacts to get metadata for the specified IDs
|
||||
const listArtifactResponse = yield artifact_1.default.listArtifacts(Object.assign({ latest: true }, options));
|
||||
artifacts = listArtifactResponse.artifacts.filter(artifact => artifactIds.includes(artifact.id));
|
||||
}
|
||||
// We need to fetch all artifacts to get metadata for the specified IDs
|
||||
const listArtifactResponse = yield artifact_1.default.listArtifacts(Object.assign({ latest: true }, options));
|
||||
artifacts = listArtifactResponse.artifacts.filter(artifact => artifactIds.includes(artifact.id));
|
||||
if (artifacts.length === 0) {
|
||||
throw new Error(`None of the provided artifact IDs were found`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue