diff --git a/src/VCS/Adapter/Git/GitHub.php b/src/VCS/Adapter/Git/GitHub.php index 0edf869..7e22428 100644 --- a/src/VCS/Adapter/Git/GitHub.php +++ b/src/VCS/Adapter/Git/GitHub.php @@ -452,6 +452,7 @@ public function getCommit(string $owner, string $repositoryName, string $commitH return [ 'commitAuthor' => $response['body']['commit']['author']['name'], 'commitMessage' => $response['body']['commit']['message'], + 'commitAuthorAvatar' => $response['body']['author']['avatar_url'], ]; } @@ -473,7 +474,8 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b !isset($response['body']['commit']['author']['name']) || !isset($response['body']['commit']['message']) || !isset($response['body']['sha']) || - !isset($response['body']['html_url']) + !isset($response['body']['html_url']) || + !isset($response['body']['author']['avatar_url']) ) { throw new Exception("Latest commit response is missing required information."); } @@ -482,7 +484,8 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b 'commitAuthor' => $response['body']['commit']['author']['name'], 'commitMessage' => $response['body']['commit']['message'], 'commitHash' => $response['body']['sha'], - 'commitUrl' => $response['body']['html_url'] + 'commitUrl' => $response['body']['html_url'], + 'commitAuthorAvatar' => $response['body']['author']['avatar_url'], ]; } diff --git a/tests/VCS/Adapter/GitHubTest.php b/tests/VCS/Adapter/GitHubTest.php index 3116aa3..9ff41ec 100644 --- a/tests/VCS/Adapter/GitHubTest.php +++ b/tests/VCS/Adapter/GitHubTest.php @@ -325,11 +325,13 @@ public function testGetCommit(): void { $commitDetails = $this->vcsAdapter->getCommit('test-kh', 'test1', '7ae65094d56edafc48596ffbb77950e741e56412'); $this->assertIsArray($commitDetails); + $this->assertEquals('https://avatars.githubusercontent.com/u/43381712?v=4', $commitDetails['commitAuthorAvatar']); } public function testGetLatestCommit(): void { $commitDetails = $this->vcsAdapter->getLatestCommit('test-kh', 'test1', 'test'); $this->assertEquals('Khushboo Verma', $commitDetails['commitAuthor']); + $this->assertEquals('https://avatars.githubusercontent.com/u/43381712?v=4', $commitDetails['commitAuthorAvatar']); } }