setFailed if certain items don't upload

This commit is contained in:
Konrad Pabjan 2020-05-15 23:54:56 +02:00
parent c414a17f7b
commit a3ada505b2
2 changed files with 17 additions and 4 deletions

9
dist/index.js vendored
View file

@ -4005,8 +4005,13 @@ function run() {
const options = {
continueOnError: false
};
yield artifactClient.uploadArtifact(name || constants_1.getDefaultArtifactName(), searchResult.filesToUpload, searchResult.rootDirectory, options);
core.info('Artifact upload has finished successfully!');
const uploadResponse = yield artifactClient.uploadArtifact(name || constants_1.getDefaultArtifactName(), 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!`);
}
}
}
catch (err) {