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)
A Github Action for creating Github Releases
A GitHub Action for creating GitHub Releases
## Usage
@ -31,10 +31,10 @@ jobs:
| Name | Type | Description |
|---------|---------|---------------------------------------------------------------|
| `body` | String | text communicating notable changes in this release |
| `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|
| `name` | String | name of the release. defaults to tag name |
| `body` | String | Text communicating notable changes in this release |
| `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|
| `name` | String | Name of the release. defaults to tag name |
## environment variables

View file

@ -96,19 +96,22 @@ fn run(
if let Some(patterns) = conf.input_files {
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(
conf.github_token.as_str(),
conf.github_repository.as_str(),
id,
&path
.file_name()
.and_then(OsStr::to_str)
.unwrap_or_else(|| "Unknown file"),
name,
mime_or_default(&path),
File::open(&path)?,
)?;
println!("uploaded with status {}", status);
if !status.is_success() {
println!("⚠️ Failed uploading {} with error {}", name, status);
}
}
}