From 7dec35858a27084191e5e00c73c2d49909c74304 Mon Sep 17 00:00:00 2001 From: Matthias Valvekens Date: Mon, 18 Dec 2023 00:12:32 +0100 Subject: [PATCH] Update dist/index.js --- dist/index.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 6fbe82f..66d418c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -120962,6 +120962,7 @@ exports.Outputs = exports.Inputs = void 0; var Inputs; (function (Inputs) { Inputs["Name"] = "name"; + Inputs["NamePrefix"] = "name-prefix"; Inputs["Path"] = "path"; Inputs["GitHubToken"] = "github-token"; Inputs["Repository"] = "repository"; @@ -121028,6 +121029,7 @@ function run() { return __awaiter(this, void 0, void 0, function* () { const inputs = { name: core.getInput(constants_1.Inputs.Name, { required: false }), + namePrefix: core.getInput(constants_1.Inputs.NamePrefix, { required: false }), path: core.getInput(constants_1.Inputs.Path, { required: false }), token: core.getInput(constants_1.Inputs.GitHubToken, { required: false }), repository: core.getInput(constants_1.Inputs.Repository, { required: false }), @@ -121066,13 +121068,22 @@ 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`); + core.info(`No input name specified, downloading all artifacts ${inputs.namePrefix ? `starting with '${inputs.namePrefix}'` : ''}. + Extra directory with the artifact name will be created for each download`); const listArtifactResponse = yield artifact_1.default.listArtifacts(Object.assign({ latest: true }, options)); if (listArtifactResponse.artifacts.length === 0) { throw new Error(`No artifacts found for run '${inputs.runID}' in '${inputs.repository}'`); } - core.debug(`Found ${listArtifactResponse.artifacts.length} artifacts`); - artifacts = listArtifactResponse.artifacts; + if (inputs.namePrefix) { + artifacts = listArtifactResponse.artifacts.filter(art => art.name.startsWith(inputs.namePrefix)); + if (artifacts.length === 0) { + throw new Error(`No artifacts found starting with prefix ${inputs.namePrefix} for run '${inputs.runID}' in '${inputs.repository}'`); + } + } + else { + artifacts = listArtifactResponse.artifacts; + } + core.debug(`Found ${artifacts.length} artifacts`); } const downloadPromises = artifacts.map(artifact => artifact_1.default.downloadArtifact(artifact.id, Object.assign(Object.assign({}, options), { path: isSingleArtifactDownload ? resolvedPath