Skip to content

Commit 6be0265

Browse files
Merge pull request #40 from utopia-php/feat-add-commit-author-url
Feat add commit author url
2 parents c55dc7a + 83f9a2d commit 6be0265

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/VCS/Adapter/Git/GitHub.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ public function getCommit(string $owner, string $repositoryName, string $commitH
453453
'commitAuthor' => $response['body']['commit']['author']['name'],
454454
'commitMessage' => $response['body']['commit']['message'],
455455
'commitAuthorAvatar' => $response['body']['author']['avatar_url'],
456+
'commitAuthorUrl' => $response['body']['author']['html_url'],
456457
'commitHash' => $response['body']['sha'],
457458
'commitUrl' => $response['body']['html_url'],
458459
];
@@ -477,7 +478,8 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b
477478
!isset($response['body']['commit']['message']) ||
478479
!isset($response['body']['sha']) ||
479480
!isset($response['body']['html_url']) ||
480-
!isset($response['body']['author']['avatar_url'])
481+
!isset($response['body']['author']['avatar_url']) ||
482+
!isset($response['body']['author']['html_url'])
481483
) {
482484
throw new Exception("Latest commit response is missing required information.");
483485
}
@@ -488,6 +490,7 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b
488490
'commitHash' => $response['body']['sha'],
489491
'commitUrl' => $response['body']['html_url'],
490492
'commitAuthorAvatar' => $response['body']['author']['avatar_url'],
493+
'commitAuthorUrl' => $response['body']['author']['html_url'],
491494
];
492495
}
493496

tests/VCS/Adapter/GitHubTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ public function testGetCommit(): void
326326
$commitDetails = $this->vcsAdapter->getCommit('test-kh', 'test1', '7ae65094d56edafc48596ffbb77950e741e56412');
327327
$this->assertIsArray($commitDetails);
328328
$this->assertEquals('https://avatars.githubusercontent.com/u/43381712?v=4', $commitDetails['commitAuthorAvatar']);
329+
$this->assertEquals('https://github.com/vermakhushboo', $commitDetails['commitAuthorUrl']);
329330
$this->assertEquals('Khushboo Verma', $commitDetails['commitAuthor']);
330331
$this->assertEquals('Initial commit', $commitDetails['commitMessage']);
331332
$this->assertEquals('https://github.com/test-kh/test1/commit/7ae65094d56edafc48596ffbb77950e741e56412', $commitDetails['commitUrl']);
@@ -337,5 +338,6 @@ public function testGetLatestCommit(): void
337338
$commitDetails = $this->vcsAdapter->getLatestCommit('test-kh', 'test1', 'test');
338339
$this->assertEquals('Khushboo Verma', $commitDetails['commitAuthor']);
339340
$this->assertEquals('https://avatars.githubusercontent.com/u/43381712?v=4', $commitDetails['commitAuthorAvatar']);
341+
$this->assertEquals('https://github.com/vermakhushboo', $commitDetails['commitAuthorUrl']);
340342
}
341343
}

0 commit comments

Comments
 (0)