Support multiple unarchived file uploads

This commit is contained in:
2026-05-05 18:23:13 +03:00
parent 227b403105
commit 8b22fe549b
4 changed files with 39 additions and 18 deletions
+16 -8
View File
@@ -130597,14 +130597,6 @@ async function run() {
const s = searchResult.filesToUpload.length === 1 ? '' : 's';
info(`With the provided path, there will be ${searchResult.filesToUpload.length} file${s} uploaded`);
core_debug(`Root artifact directory is ${searchResult.rootDirectory}`);
// Validate that only a single file is uploaded when archive is false
if (!inputs.archive && searchResult.filesToUpload.length > 1) {
setFailed(`When 'archive' is set to false, only a single file can be uploaded. Found ${searchResult.filesToUpload.length} files to upload.`);
return;
}
if (inputs.overwrite) {
await deleteArtifactIfExists(inputs.artifactName);
}
const options = {};
if (inputs.retentionDays) {
options.retentionDays = inputs.retentionDays;
@@ -130614,6 +130606,22 @@ async function run() {
}
if (!inputs.archive) {
options.skipArchive = true;
// Gitea patch: upstream upload-artifact@v7 only supports skipArchive
// for one file per artifact. Accept multi-path/multi-file input by
// creating one unarchived artifact for each matched file. In
// skipArchive mode the library names the artifact after the file's
// basename, matching upstream single-file behavior.
for (const fileToUpload of searchResult.filesToUpload) {
const artifactName = external_path_.basename(fileToUpload);
if (inputs.overwrite) {
await deleteArtifactIfExists(artifactName);
}
await upload_artifact_uploadArtifact(artifactName, [fileToUpload], searchResult.rootDirectory, options);
}
return;
}
if (inputs.overwrite) {
await deleteArtifactIfExists(inputs.artifactName);
}
await upload_artifact_uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options);
}