Skip to content

Commit

Permalink
Merge pull request #47 from tanhongit/refactor-events
Browse files Browse the repository at this point in the history
(#42) add conditions to check and exclude invalid chat ids
  • Loading branch information
tanhongit authored Jun 28, 2023
2 parents d84e1e4 + 857284b commit 3ff95ab
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions resources/events/pull_request_review/dismissed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* @var $payload mixed
*/

$message = "👷‍♂️🛠️ <b>Dismissed Pull Request Review Comment</b> - <a href=\"{$payload->pull_request->html_url}\">{$payload->repository->full_name}#{$payload->pull_request->number}</a> by <a href=\"{$payload->review->user->html_url}\">@{$payload->review->user->login}</a>\n\n";

$message .= "🛠 <b>{$payload->pull_request->title}</b> \n\n";

$message .= "🔗 Link: <a href=\"{$payload->review->html_url}\">{$payload->review->html_url}</a>\n\n";

echo $message;
12 changes: 12 additions & 0 deletions resources/events/pull_request_review/submitted.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* @var $payload mixed
*/

$message = "👷‍♂️🛠️ <b>New Pull Request Review Comment</b> - <a href=\"{$payload->pull_request->html_url}\">{$payload->repository->full_name}#{$payload->pull_request->number}</a> by <a href=\"{$payload->review->user->html_url}\">@{$payload->review->user->login}</a>\n\n";

$message .= "🛠 <b>{$payload->pull_request->title}</b> \n\n";

$message .= "🔗 Link: <a href=\"{$payload->review->html_url}\">{$payload->review->html_url}</a>\n\n";

echo $message;
4 changes: 4 additions & 0 deletions src/Http/Actions/SendNotifyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function __invoke(): void
if (!is_null($this->request->server->get('HTTP_X_GITHUB_EVENT')) && empty($chatMessageId)) {
$this->notificationService->setPayload($this->request);
foreach ($this->chatIds as $chatId) {
if (empty($chatId)) {
continue;
}

$this->notificationService->sendNotify($chatId);
}
}
Expand Down

0 comments on commit 3ff95ab

Please sign in to comment.