Abstract BuildStatus -> String
This commit is contained in:
parent
e7e6d7314a
commit
6e20832e95
|
@ -9,6 +9,18 @@ pub enum BuildStatus {
|
|||
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 repo: Repo,
|
||||
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!(
|
||||
"{} on {}{}",
|
||||
(match result.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),
|
||||
}),
|
||||
String::from(result.status.clone()),
|
||||
result.system,
|
||||
log_link
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue