@@ -244,6 +244,7 @@ async fn handle_successful_build(
244244 & approval_info. approver ,
245245 & commit_sha,
246246 & pr. base_branch ,
247+ auto_build. duration . map ( |d| d. inner ( ) ) ,
247248 ) ;
248249
249250 if let Err ( error) = repo
@@ -793,6 +794,7 @@ merge_queue_enabled = false
793794 @r#"
794795 :sunny: Test successful - [Workflow1](https://github.com/rust-lang/borstest/actions/runs/1)
795796 Approved by: `default-user`
797+ Duration: `1h`
796798 Pushing merge-0-pr-1-d7d45f1f-reauthored-to-bors to `main`...
797799 <!-- homu: {"type":"BuildCompleted","base_ref":"main","merge_sha":"merge-0-pr-1-d7d45f1f-reauthored-to-bors"} -->
798800 "#
@@ -802,6 +804,84 @@ merge_queue_enabled = false
802804 . await ;
803805 }
804806
807+ #[ sqlx:: test]
808+ async fn auto_build_success_comment_duration_hours_minutes ( pool : sqlx:: PgPool ) {
809+ // Test with hours and minutes (4800 seconds = 1h 20m)
810+ run_test ( pool, async |ctx : & mut BorsTester | {
811+ ctx. approve ( ( ) ) . await ?;
812+ ctx. start_auto_build ( ( ) ) . await ?;
813+ let w1 = ctx. auto_workflow ( ) ;
814+ ctx. modify_workflow ( w1, |w| w. set_duration ( Duration :: from_secs ( 4800 ) ) ) ;
815+ ctx. workflow_full_success ( w1) . await ?;
816+ ctx. run_merge_queue_until_merge_attempt ( ) . await ;
817+
818+ insta:: assert_snapshot!(
819+ ctx. get_next_comment_text( ( ) ) . await ?,
820+ @r#"
821+ :sunny: Test successful - [Workflow1](https://github.com/rust-lang/borstest/actions/runs/1)
822+ Approved by: `default-user`
823+ Duration: `1h 20m`
824+ Pushing merge-0-pr-1-d7d45f1f-reauthored-to-bors to `main`...
825+ <!-- homu: {"type":"BuildCompleted","base_ref":"main","merge_sha":"merge-0-pr-1-d7d45f1f-reauthored-to-bors"} -->
826+ "#
827+ ) ;
828+ Ok ( ( ) )
829+ } )
830+ . await ;
831+ }
832+
833+ #[ sqlx:: test]
834+ async fn auto_build_success_comment_duration_all_units ( pool : sqlx:: PgPool ) {
835+ // Test with hours, minutes and seconds (12345 seconds = 3h 25m 45s)
836+ run_test ( pool, async |ctx : & mut BorsTester | {
837+ ctx. approve ( ( ) ) . await ?;
838+ ctx. start_auto_build ( ( ) ) . await ?;
839+ let w1 = ctx. auto_workflow ( ) ;
840+ ctx. modify_workflow ( w1, |w| w. set_duration ( Duration :: from_secs ( 12345 ) ) ) ;
841+ ctx. workflow_full_success ( w1) . await ?;
842+ ctx. run_merge_queue_until_merge_attempt ( ) . await ;
843+
844+ insta:: assert_snapshot!(
845+ ctx. get_next_comment_text( ( ) ) . await ?,
846+ @r#"
847+ :sunny: Test successful - [Workflow1](https://github.com/rust-lang/borstest/actions/runs/1)
848+ Approved by: `default-user`
849+ Duration: `3h 25m 45s`
850+ Pushing merge-0-pr-1-d7d45f1f-reauthored-to-bors to `main`...
851+ <!-- homu: {"type":"BuildCompleted","base_ref":"main","merge_sha":"merge-0-pr-1-d7d45f1f-reauthored-to-bors"} -->
852+ "#
853+ ) ;
854+ Ok ( ( ) )
855+ } )
856+ . await ;
857+ }
858+
859+ #[ sqlx:: test]
860+ async fn auto_build_success_comment_duration_seconds_only ( pool : sqlx:: PgPool ) {
861+ // Test with just seconds (45 seconds)
862+ run_test ( pool, async |ctx : & mut BorsTester | {
863+ ctx. approve ( ( ) ) . await ?;
864+ ctx. start_auto_build ( ( ) ) . await ?;
865+ let w1 = ctx. auto_workflow ( ) ;
866+ ctx. modify_workflow ( w1, |w| w. set_duration ( Duration :: from_secs ( 45 ) ) ) ;
867+ ctx. workflow_full_success ( w1) . await ?;
868+ ctx. run_merge_queue_until_merge_attempt ( ) . await ;
869+
870+ insta:: assert_snapshot!(
871+ ctx. get_next_comment_text( ( ) ) . await ?,
872+ @r#"
873+ :sunny: Test successful - [Workflow1](https://github.com/rust-lang/borstest/actions/runs/1)
874+ Approved by: `default-user`
875+ Duration: `45s`
876+ Pushing merge-0-pr-1-d7d45f1f-reauthored-to-bors to `main`...
877+ <!-- homu: {"type":"BuildCompleted","base_ref":"main","merge_sha":"merge-0-pr-1-d7d45f1f-reauthored-to-bors"} -->
878+ "#
879+ ) ;
880+ Ok ( ( ) )
881+ } )
882+ . await ;
883+ }
884+
805885 #[ sqlx:: test]
806886 async fn auto_build_failure_comment ( pool : sqlx:: PgPool ) {
807887 run_test ( pool, async |ctx : & mut BorsTester | {
0 commit comments