Only gist on failures

This commit is contained in:
Graham Christensen 2017-12-04 19:13:34 -05:00
parent 1fc075a5b7
commit 55c9d50706
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -270,35 +270,35 @@ impl worker::SimpleWorker for MassRebuildWorker {
status.set(hubcaps::statuses::State::Pending);
let state: hubcaps::statuses::State;
let mut out: File;
let gist_url: Option<String>;
match check.execute(Path::new(&refpath)) {
Ok(o) => {
out = o;
Ok(_) => {
state = hubcaps::statuses::State::Success;
gist_url = None;
}
Err(o) => {
out = o;
Err(mut out) => {
state = hubcaps::statuses::State::Failure;
let mut files = HashMap::new();
files.insert(check.name(),
hubcaps::gists::Content {
filename: Some(check.name()),
content: file_to_str(&mut out),
}
);
gist_url = Some(gists.create(
&hubcaps::gists::GistOptions {
description: Some(format!("{:?}", state)),
public: Some(true),
files: files,
}
).expect("Failed to create gist!").html_url);
}
}
let mut files = HashMap::new();
files.insert(check.name(),
hubcaps::gists::Content {
filename: Some(check.name()),
content: file_to_str(&mut out),
}
);
let gist_url = gists.create(
&hubcaps::gists::GistOptions {
description: Some(format!("{:?}", state)),
public: Some(true),
files: files,
}
).expect("Failed to create gist!").html_url;
status.set_url(Some(gist_url));
status.set_url(gist_url);
status.set(state.clone());
if state == hubcaps::statuses::State::Success {