diff --git a/action.yml b/action.yml index dbdbc92..50e297a 100644 --- a/action.yml +++ b/action.yml @@ -2,9 +2,6 @@ name: 'Upload a Build Artifact' description: 'Upload a build artifact that can be used by subsequent workflow steps' author: 'GitHub' inputs: - name: - description: 'Artifact name' - default: 'artifact' path: description: 'A file, directory or wildcard pattern that describes what to upload' required: true diff --git a/dist/index.js b/dist/index.js index b1a9863..7b7cf96 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4019,12 +4019,14 @@ function run() { const options = { continueOnError: false }; - const uploadResponse = yield artifactClient.uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options); - if (uploadResponse.failedItems.length > 0) { - core.setFailed(`An error was encountered when uploading ${uploadResponse.artifactName}. There were ${uploadResponse.failedItems.length} items that failed to upload.`); - } - else { - core.info(`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`); + for (const file of searchResult.filesToUpload) { + const uploadResponse = yield artifactClient.uploadArtifact(file, [file], searchResult.rootDirectory, options); + if (uploadResponse.failedItems.length > 0) { + core.setFailed(`An error was encountered when uploading ${uploadResponse.artifactName}. There were ${uploadResponse.failedItems.length} items that failed to upload.`); + } + else { + core.info(`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`); + } } } } @@ -6383,7 +6385,6 @@ const constants_1 = __webpack_require__(694); * Helper to get all the inputs for the action */ function getInputs() { - const name = core.getInput(constants_1.Inputs.Name); const path = core.getInput(constants_1.Inputs.Path, { required: true }); const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound); const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound]; @@ -6391,7 +6392,6 @@ function getInputs() { core.setFailed(`Unrecognized ${constants_1.Inputs.IfNoFilesFound} input. Provided: ${ifNoFilesFound}. Available options: ${Object.keys(constants_1.NoFileOptions)}`); } return { - artifactName: name, searchPath: path, ifNoFilesFound: noFileBehavior }; diff --git a/src/input-helper.ts b/src/input-helper.ts index c58d52a..89d6473 100644 --- a/src/input-helper.ts +++ b/src/input-helper.ts @@ -6,7 +6,6 @@ import {UploadInputs} from './upload-inputs' * Helper to get all the inputs for the action */ export function getInputs(): UploadInputs { - const name = core.getInput(Inputs.Name) const path = core.getInput(Inputs.Path, {required: true}) const ifNoFilesFound = core.getInput(Inputs.IfNoFilesFound) @@ -23,7 +22,6 @@ export function getInputs(): UploadInputs { } return { - artifactName: name, searchPath: path, ifNoFilesFound: noFileBehavior } diff --git a/src/upload-artifact.ts b/src/upload-artifact.ts index e37c6b4..531a928 100644 --- a/src/upload-artifact.ts +++ b/src/upload-artifact.ts @@ -40,21 +40,24 @@ async function run(): Promise { const options: UploadOptions = { continueOnError: false } - const uploadResponse = await artifactClient.uploadArtifact( - inputs.artifactName, - searchResult.filesToUpload, - searchResult.rootDirectory, - options - ) - if (uploadResponse.failedItems.length > 0) { - core.setFailed( - `An error was encountered when uploading ${uploadResponse.artifactName}. There were ${uploadResponse.failedItems.length} items that failed to upload.` - ) - } else { - core.info( - `Artifact ${uploadResponse.artifactName} has been successfully uploaded!` + for (const file of searchResult.filesToUpload) { + const uploadResponse = await artifactClient.uploadArtifact( + file, + [file], + searchResult.rootDirectory, + options ) + + if (uploadResponse.failedItems.length > 0) { + core.setFailed( + `An error was encountered when uploading ${uploadResponse.artifactName}. There were ${uploadResponse.failedItems.length} items that failed to upload.` + ) + } else { + core.info( + `Artifact ${uploadResponse.artifactName} has been successfully uploaded!` + ) + } } } } catch (err) { diff --git a/src/upload-inputs.ts b/src/upload-inputs.ts index 60e4a84..bd958bf 100644 --- a/src/upload-inputs.ts +++ b/src/upload-inputs.ts @@ -1,11 +1,6 @@ import {NoFileOptions} from './constants' export interface UploadInputs { - /** - * The name of the artifact that will be uploaded - */ - artifactName: string - /** * The search path used to describe what to upload as part of the artifact */