From c3d17d9e25a2fef84c9adf87c84a1ceeaaa5f590 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 31 Aug 2018 16:43:15 -0400 Subject: [PATCH] Fixup comment formatting --- ofborg/src/tasks/githubcommentposter.rs | 29 +++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/ofborg/src/tasks/githubcommentposter.rs b/ofborg/src/tasks/githubcommentposter.rs index a65b54e..8487d56 100644 --- a/ofborg/src/tasks/githubcommentposter.rs +++ b/ofborg/src/tasks/githubcommentposter.rs @@ -98,9 +98,8 @@ fn result_to_comment(result: &BuildResult) -> String { Some(ref s) => s, }; - reply.push(format!( - "{} on {}{}", - result.request_id, + reply.push(format!("", result.request_id)); + reply.push(format!("{} on {}{}", (match *status { BuildStatus::Skipped => "No attempt".into(), BuildStatus::Success => "Success".into(), @@ -206,7 +205,8 @@ mod tests { assert_eq!( &result_to_comment(&result), - "Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) + " +Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) Attempted: foo @@ -269,7 +269,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 assert_eq!( &result_to_comment(&result), - "Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) + " +Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) Attempted: foo @@ -329,7 +330,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 assert_eq!( &result_to_comment(&result), - "Timed out, unknown build status on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) + " +Timed out, unknown build status on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) Attempted: foo @@ -389,7 +391,8 @@ error: build of '/nix/store/l1limh50lx2cx45yb2gqpv7k8xl1mik2-gdb-8.1.drv' failed assert_eq!( &result_to_comment(&result), - "Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) + " +Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Partial log (click to expand)

@@ -448,7 +451,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 assert_eq!( &result_to_comment(&result), - "Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) + " +Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)

Partial log (click to expand)

@@ -496,7 +500,8 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 assert_eq!( &result_to_comment(&result), - "No attempt on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=foo) + " +No attempt on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=foo) The following builds were skipped because they don't evaluate on x86_64-linux: not-attempted @@ -537,7 +542,8 @@ foo assert_eq!( &result_to_comment(&result), - "No attempt on x86_64-linux + " +No attempt on x86_64-linux The following builds were skipped because they don't evaluate on x86_64-linux: not-attempted @@ -583,7 +589,8 @@ No partial log is available. assert_eq!( &result_to_comment(&result), - "Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) + " +Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid) Attempted: foo