mirror of
https://github.com/actions/upload-artifact.git
synced 2024-11-24 12:12:09 +00:00
setFailed if certain items don't upload
This commit is contained in:
parent
c414a17f7b
commit
a3ada505b2
2 changed files with 17 additions and 4 deletions
9
dist/index.js
vendored
9
dist/index.js
vendored
|
@ -4005,8 +4005,13 @@ function run() {
|
||||||
const options = {
|
const options = {
|
||||||
continueOnError: false
|
continueOnError: false
|
||||||
};
|
};
|
||||||
yield artifactClient.uploadArtifact(name || constants_1.getDefaultArtifactName(), searchResult.filesToUpload, searchResult.rootDirectory, options);
|
const uploadResponse = yield artifactClient.uploadArtifact(name || constants_1.getDefaultArtifactName(), searchResult.filesToUpload, searchResult.rootDirectory, options);
|
||||||
core.info('Artifact upload has finished successfully!');
|
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) {
|
catch (err) {
|
||||||
|
|
|
@ -23,14 +23,22 @@ async function run(): Promise<void> {
|
||||||
const options: UploadOptions = {
|
const options: UploadOptions = {
|
||||||
continueOnError: false
|
continueOnError: false
|
||||||
}
|
}
|
||||||
await artifactClient.uploadArtifact(
|
const uploadResponse = await artifactClient.uploadArtifact(
|
||||||
name || getDefaultArtifactName(),
|
name || getDefaultArtifactName(),
|
||||||
searchResult.filesToUpload,
|
searchResult.filesToUpload,
|
||||||
searchResult.rootDirectory,
|
searchResult.rootDirectory,
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
|
|
||||||
core.info('Artifact upload has finished successfully!')
|
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) {
|
} catch (err) {
|
||||||
core.setFailed(err.message)
|
core.setFailed(err.message)
|
||||||
|
|
Loading…
Reference in a new issue