@@ -915,8 +915,14 @@ public function createCheckRun(
915915 ], fn ($ value ) => !empty ($ value ))
916916 );
917917
918- $ output = $ this ->buildCheckRunOutput ($ title , $ summary , $ text , $ annotations , $ images );
919- if (!empty ($ output )) {
918+ if (!empty ($ title ) || !empty ($ summary )) {
919+ $ output = array_filter (['title ' => $ title , 'summary ' => $ summary , 'text ' => $ text ], fn ($ value ) => !empty ($ value ));
920+ if (!empty ($ annotations )) {
921+ $ output ['annotations ' ] = $ annotations ;
922+ }
923+ if (!empty ($ images )) {
924+ $ output ['images ' ] = $ images ;
925+ }
920926 $ body ['output ' ] = $ output ;
921927 }
922928
@@ -977,8 +983,14 @@ public function updateCheckRun(
977983 'completed_at ' => $ completedAt ,
978984 ], fn ($ value ) => !empty ($ value ));
979985
980- $ output = $ this ->buildCheckRunOutput ($ title , $ summary , $ text , $ annotations , $ images );
981- if (!empty ($ output )) {
986+ if (!empty ($ title ) || !empty ($ summary )) {
987+ $ output = array_filter (['title ' => $ title , 'summary ' => $ summary , 'text ' => $ text ], fn ($ value ) => !empty ($ value ));
988+ if (!empty ($ annotations )) {
989+ $ output ['annotations ' ] = $ annotations ;
990+ }
991+ if (!empty ($ images )) {
992+ $ output ['images ' ] = $ images ;
993+ }
982994 $ body ['output ' ] = $ output ;
983995 }
984996
@@ -987,35 +999,6 @@ public function updateCheckRun(
987999 return $ response ['body ' ] ?? [];
9881000 }
9891001
990- /**
991- * Builds the output block for a check run.
992- *
993- * @param array<mixed> $annotations
994- * @param array<mixed> $images
995- * @return array<mixed>
996- */
997- private function buildCheckRunOutput (string $ title , string $ summary , string $ text , array $ annotations , array $ images ): array
998- {
999- if (empty ($ title ) && empty ($ summary )) {
1000- return [];
1001- }
1002-
1003- $ output = array_filter ([
1004- 'title ' => $ title ,
1005- 'summary ' => $ summary ,
1006- 'text ' => $ text ,
1007- ], fn ($ value ) => !empty ($ value ));
1008-
1009- if (!empty ($ annotations )) {
1010- $ output ['annotations ' ] = $ annotations ;
1011- }
1012- if (!empty ($ images )) {
1013- $ output ['images ' ] = $ images ;
1014- }
1015-
1016- return $ output ;
1017- }
1018-
10191002 /**
10201003 * Generates a clone command using app access token
10211004 */
0 commit comments