error reporting

This commit is contained in:
softprops 2019-08-26 00:40:00 -04:00
parent 43b8a33025
commit db0b38cbf5
2 changed files with 14 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# action gh-release [![](https://github.com/softprops/action-gh-release/workflows/Main/badge.svg)](https://github.com/softprops/action-gh-release/actions) # action gh-release [![](https://github.com/softprops/action-gh-release/workflows/Main/badge.svg)](https://github.com/softprops/action-gh-release/actions)
A Github Action for creating Github Releases A GitHub Action for creating GitHub Releases
## Usage ## Usage
@ -31,10 +31,10 @@ jobs:
| Name | Type | Description | | Name | Type | Description |
|---------|---------|---------------------------------------------------------------| |---------|---------|---------------------------------------------------------------|
| `body` | String | text communicating notable changes in this release | | `body` | String | Text communicating notable changes in this release |
| `draft` | Boolean | indicator of whether or not this release is a draft | | `draft` | Boolean | Indicator of whether or not this release is a draft |
| `files` | String | comma-delimited globs of paths to assets to upload for release| | `files` | String | Comma-delimited globs of paths to assets to upload for release|
| `name` | String | name of the release. defaults to tag name | | `name` | String | Name of the release. defaults to tag name |
## environment variables ## environment variables

View File

@ -96,19 +96,22 @@ fn run(
if let Some(patterns) = conf.input_files { if let Some(patterns) = conf.input_files {
for path in paths(patterns)? { for path in paths(patterns)? {
println!("⬆️ Uploading asset {}", path.display()); let name = &path
.file_name()
.and_then(OsStr::to_str)
.unwrap_or_else(|| "UnknownFile");
println!("⬆️ Uploading {}...", name);
let status = uploader.upload( let status = uploader.upload(
conf.github_token.as_str(), conf.github_token.as_str(),
conf.github_repository.as_str(), conf.github_repository.as_str(),
id, id,
&path name,
.file_name()
.and_then(OsStr::to_str)
.unwrap_or_else(|| "Unknown file"),
mime_or_default(&path), mime_or_default(&path),
File::open(&path)?, File::open(&path)?,
)?; )?;
println!("uploaded with status {}", status); if !status.is_success() {
println!("⚠️ Failed uploading {} with error {}", name, status);
}
} }
} }