Abstract BuildStatus -> String
This commit is contained in:
parent
e7e6d7314a
commit
6e20832e95
|
@ -9,6 +9,18 @@ pub enum BuildStatus {
|
||||||
UnexpectedError { err: String },
|
UnexpectedError { err: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<BuildStatus> for String {
|
||||||
|
fn from(status: BuildStatus) -> String {
|
||||||
|
match status {
|
||||||
|
BuildStatus::Skipped => "No attempt".into(),
|
||||||
|
BuildStatus::Success => "Success".into(),
|
||||||
|
BuildStatus::Failure => "Failure".into(),
|
||||||
|
BuildStatus::TimedOut => "Timed out, unknown build status".into(),
|
||||||
|
BuildStatus::UnexpectedError { ref err } => format!("Unexpected error: {}", err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct LegacyBuildResult {
|
pub struct LegacyBuildResult {
|
||||||
pub repo: Repo,
|
pub repo: Repo,
|
||||||
pub pr: Pr,
|
pub pr: Pr,
|
||||||
|
|
|
@ -166,13 +166,7 @@ fn result_to_comment(result: &LegacyBuildResult) -> String {
|
||||||
reply.push(format!("<!--REQUEST_ID={}-->", result.request_id));
|
reply.push(format!("<!--REQUEST_ID={}-->", result.request_id));
|
||||||
reply.push(format!(
|
reply.push(format!(
|
||||||
"{} on {}{}",
|
"{} on {}{}",
|
||||||
(match result.status {
|
String::from(result.status.clone()),
|
||||||
BuildStatus::Skipped => "No attempt".into(),
|
|
||||||
BuildStatus::Success => "Success".into(),
|
|
||||||
BuildStatus::Failure => "Failure".into(),
|
|
||||||
BuildStatus::TimedOut => "Timed out, unknown build status".into(),
|
|
||||||
BuildStatus::UnexpectedError { ref err } => format!("Unexpected error: {}", err),
|
|
||||||
}),
|
|
||||||
result.system,
|
result.system,
|
||||||
log_link
|
log_link
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue