mirror of
https://github.com/actions/download-artifact.git
synced 2025-04-23 14:46:43 +08:00
bundle
This commit is contained in:
parent
ec378bcca1
commit
e463631f66
24
dist/index.js
vendored
24
dist/index.js
vendored
@ -118839,15 +118839,29 @@ function run() {
|
||||
core.debug(`Parsed artifact IDs: ${JSON.stringify(artifactIdList)}`);
|
||||
// Parse the artifact IDs
|
||||
artifactIds = artifactIdList.map(id => {
|
||||
const numericId = parseInt(id);
|
||||
const numericId = parseInt(id, 10);
|
||||
if (isNaN(numericId)) {
|
||||
throw new Error(`Invalid artifact ID: '${id}'. Must be a number.`);
|
||||
}
|
||||
return numericId;
|
||||
});
|
||||
// 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 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 getArtifactResponse = yield artifact_1.default.getArtifact(inputs.name, Object.assign({}, options));
|
||||
if (!getArtifactResponse || !getArtifactResponse.artifact) {
|
||||
throw new Error(`Artifact with ID '${artifactIds[0]}' not found. Please check the ID.`);
|
||||
}
|
||||
const artifact = getArtifactResponse.artifact;
|
||||
core.debug(`Found artifact by ID '${artifact.name}' (ID: ${artifact.id}, Size: ${artifact.size})`);
|
||||
artifacts = [artifact];
|
||||
}
|
||||
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));
|
||||
}
|
||||
if (artifacts.length === 0) {
|
||||
throw new Error(`None of the provided artifact IDs were found`);
|
||||
}
|
||||
@ -128958,4 +128972,4 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
|
||||
/******/ module.exports = __webpack_exports__;
|
||||
/******/
|
||||
/******/ })()
|
||||
;
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user