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