Skip to content

Commit e519452

Browse files
committed
fix: tolerate null author in getLatestCommit for GitHub App commits
1 parent a9f1df7 commit e519452

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/VCS/Adapter/Git/GitHub.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -930,15 +930,15 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b
930930
$responseBody = $response['body'] ?? [];
931931
$responseBodyCommit = $responseBody['commit'] ?? [];
932932
$responseBodyCommitAuthor = $responseBodyCommit['author'] ?? [];
933-
$responseBodyAuthor = $responseBody['author'] ?? [];
933+
// GitHub sets author to null for commits from App installations whose email
934+
// does not match any GitHub user — treat it as an empty array to allow fallbacks.
935+
$responseBodyAuthor = is_array($responseBody['author'] ?? null) ? $responseBody['author'] : [];
934936

935937
if (
936938
!array_key_exists('name', $responseBodyCommitAuthor) ||
937939
!array_key_exists('message', $responseBodyCommit) ||
938940
!array_key_exists('sha', $responseBody) ||
939-
!array_key_exists('html_url', $responseBody) ||
940-
!array_key_exists('avatar_url', $responseBodyAuthor) ||
941-
!array_key_exists('html_url', $responseBodyAuthor)
941+
!array_key_exists('html_url', $responseBody)
942942
) {
943943
throw new Exception("Latest commit response is missing required information.");
944944
}

0 commit comments

Comments
 (0)