@@ -494,17 +494,17 @@ public function getCommit(string $owner, string $repositoryName, string $commitH
494494
495495 $ response = $ this ->call (self ::METHOD_GET , $ url , ['Authorization ' => "Bearer $ this ->accessToken " ]);
496496
497- if (! isset ( $ response [ ' body ' ][ ' commit ' ][ ' author ' ][ ' name ' ]) || ! isset ( $ response ['body ' ][ ' commit ' ][ ' message ' ])) {
498- throw new Exception ( " Commit author or message information missing. " ) ;
499- }
497+ $ body = $ response ['body ' ] ?? [];
498+ $ commit = $ body [ ' commit ' ] ?? [] ;
499+ $ author = $ commit [ ' author ' ] ?? [];
500500
501501 return [
502- 'commitAuthor ' => $ response [ ' body ' ][ ' commit ' ][ ' author ' ] ['name ' ],
503- 'commitMessage ' => $ response [ ' body ' ][ ' commit ' ][ ' message '] ,
504- 'commitAuthorAvatar ' => $ response [ ' body ' ][ ' author ' ] ['avatar_url ' ],
505- 'commitAuthorUrl ' => $ response [ ' body ' ][ ' author ' ] ['html_url ' ],
506- 'commitHash ' => $ response [ ' body ' ] ['sha ' ],
507- 'commitUrl ' => $ response [ ' body ' ] ['html_url ' ],
502+ 'commitAuthor ' => $ author ['name ' ] ?? ' Unknown ' ,
503+ 'commitMessage ' => $ commit [ ' message ' ] ?? ' No message ' ,
504+ 'commitAuthorAvatar ' => $ author ['avatar_url ' ] ?? '' ,
505+ 'commitAuthorUrl ' => $ author ['html_url ' ] ?? '' ,
506+ 'commitHash ' => $ body ['sha ' ] ?? '' ,
507+ 'commitUrl ' => $ body ['html_url ' ] ?? '' ,
508508 ];
509509 }
510510
0 commit comments