diff --git a/src/VCS/Adapter/Git/GitHub.php b/src/VCS/Adapter/Git/GitHub.php index 15ef158..a3e14b3 100644 --- a/src/VCS/Adapter/Git/GitHub.php +++ b/src/VCS/Adapter/Git/GitHub.php @@ -582,6 +582,7 @@ public function getEvent(string $event, string $payload): array $commitHash = $payload['after'] ?? ''; $owner = $payload['repository']['owner']['name'] ?? ''; $authorUrl = $payload['sender']['html_url']; + $authorAvatarUrl = $payload['sender']['avatar_url'] ?? ''; $headCommitAuthor = $payload['head_commit']['author']['name'] ?? ''; $headCommitMessage = $payload['head_commit']['message'] ?? ''; $headCommitUrl = $payload['head_commit']['url'] ?? ''; @@ -597,6 +598,7 @@ public function getEvent(string $event, string $payload): array 'commitHash' => $commitHash, 'owner' => $owner, 'authorUrl' => $authorUrl, + 'authorAvatarUrl' => $authorAvatarUrl, 'headCommitAuthor' => $headCommitAuthor, 'headCommitMessage' => $headCommitMessage, 'headCommitUrl' => $headCommitUrl, @@ -614,6 +616,7 @@ public function getEvent(string $event, string $payload): array $action = $payload['action'] ?? ''; $owner = $payload['repository']['owner']['login'] ?? ''; $authorUrl = $payload['sender']['html_url']; + $authorAvatarUrl = $payload['pull_request']['user']['avatar_url'] ?? ''; $commitHash = $payload['pull_request']['head']['sha'] ?? ''; $headCommitUrl = $repositoryUrl . "/commits/" . $commitHash; $external = $payload['pull_request']['head']['user']['login'] !== $payload['pull_request']['base']['user']['login']; @@ -628,6 +631,7 @@ public function getEvent(string $event, string $payload): array 'commitHash' => $commitHash, 'owner' => $owner, 'authorUrl' => $authorUrl, + 'authorAvatarUrl' => $authorAvatarUrl, 'headCommitUrl' => $headCommitUrl, 'external' => $external, 'pullRequestNumber' => $pullRequestNumber, diff --git a/tests/VCS/Adapter/GitHubTest.php b/tests/VCS/Adapter/GitHubTest.php index b738145..5819660 100644 --- a/tests/VCS/Adapter/GitHubTest.php +++ b/tests/VCS/Adapter/GitHubTest.php @@ -54,7 +54,8 @@ public function testgetEvent(): void "url": "https://github.com/vermakhushboo/g4-node-function/commit/b787f03343171ff5a477627796140bfa1d02da09" }, "sender": { - "html_url": "https://github.com/vermakhushboo" + "html_url": "https://github.com/vermakhushboo", + "avatar_url": "https://avatars.githubusercontent.com/u/43381712?v=4" } }'; @@ -78,6 +79,10 @@ public function testgetEvent(): void "user": { "login": "vermakhushboo" } + }, + "user" : { + "login": "vermakhushboo", + "avatar_url": "https://avatars.githubusercontent.com/u/43381712?v=4" } }, "repository": {