@@ -900,6 +900,14 @@ public function createCheckRun(
900900 ): array {
901901 $ url = "/repos/ $ owner/ $ repositoryName/check-runs " ;
902902
903+ // Conclusion requires status=completed; auto-set completed_at if not provided.
904+ if (!empty ($ conclusion )) {
905+ $ status = 'completed ' ;
906+ if (empty ($ completedAt )) {
907+ $ completedAt = gmdate ('Y-m-d\TH:i:s\Z ' );
908+ }
909+ }
910+
903911 $ body = array_merge (
904912 [
905913 'name ' => $ name ,
@@ -915,7 +923,8 @@ public function createCheckRun(
915923 ], fn ($ value ) => !empty ($ value ))
916924 );
917925
918- if (!empty ($ title ) || !empty ($ summary )) {
926+ // Output requires both title and summary.
927+ if (!empty ($ title ) && !empty ($ summary )) {
919928 $ output = array_filter (['title ' => $ title , 'summary ' => $ summary , 'text ' => $ text ], fn ($ value ) => !empty ($ value ));
920929 if (!empty ($ annotations )) {
921930 $ output ['annotations ' ] = $ annotations ;
@@ -973,6 +982,14 @@ public function updateCheckRun(
973982 ): array {
974983 $ url = "/repos/ $ owner/ $ repositoryName/check-runs/ $ checkRunId " ;
975984
985+ // Conclusion requires status=completed; auto-set completed_at if not provided.
986+ if (!empty ($ conclusion )) {
987+ $ status = 'completed ' ;
988+ if (empty ($ completedAt )) {
989+ $ completedAt = gmdate ('Y-m-d\TH:i:s\Z ' );
990+ }
991+ }
992+
976993 $ body = array_filter ([
977994 'name ' => $ name ,
978995 'status ' => $ status ,
@@ -983,7 +1000,8 @@ public function updateCheckRun(
9831000 'completed_at ' => $ completedAt ,
9841001 ], fn ($ value ) => !empty ($ value ));
9851002
986- if (!empty ($ title ) || !empty ($ summary )) {
1003+ // Output requires both title and summary.
1004+ if (!empty ($ title ) && !empty ($ summary )) {
9871005 $ output = array_filter (['title ' => $ title , 'summary ' => $ summary , 'text ' => $ text ], fn ($ value ) => !empty ($ value ));
9881006 if (!empty ($ annotations )) {
9891007 $ output ['annotations ' ] = $ annotations ;
0 commit comments