Skip to content

Commit af089d4

Browse files
committed
Add commit author url
1 parent 1a8d280 commit af089d4

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/VCS/Adapter/Git/GitHub.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,8 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b
477477
!isset($response['body']['commit']['message']) ||
478478
!isset($response['body']['sha']) ||
479479
!isset($response['body']['html_url']) ||
480-
!isset($response['body']['author']['avatar_url'])
480+
!isset($response['body']['committer']['avatar_url']) ||
481+
!isset($response['body']['committer']['html_url'])
481482
) {
482483
throw new Exception("Latest commit response is missing required information.");
483484
}
@@ -487,7 +488,8 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b
487488
'commitMessage' => $response['body']['commit']['message'],
488489
'commitHash' => $response['body']['sha'],
489490
'commitUrl' => $response['body']['html_url'],
490-
'commitAuthorAvatar' => $response['body']['author']['avatar_url'],
491+
'commitAuthorAvatar' => $response['body']['committer']['avatar_url'],
492+
'commitAuthorUrl' => $response['body']['committer']['html_url'],
491493
];
492494
}
493495

tests/VCS/Adapter/GitHubTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,5 +337,6 @@ public function testGetLatestCommit(): void
337337
$commitDetails = $this->vcsAdapter->getLatestCommit('test-kh', 'test1', 'test');
338338
$this->assertEquals('Khushboo Verma', $commitDetails['commitAuthor']);
339339
$this->assertEquals('https://avatars.githubusercontent.com/u/43381712?v=4', $commitDetails['commitAuthorAvatar']);
340+
$this->assertEquals('https://github.com/vermakhushboo', $commitDetails['commitAuthorUrl']);
340341
}
341342
}

0 commit comments

Comments
 (0)