diff --git a/resources/events/issues/action/closed.php b/resources/events/issues/closed.php similarity index 90% rename from resources/events/issues/action/closed.php rename to resources/events/issues/closed.php index f38dd5c..c4a8704 100644 --- a/resources/events/issues/action/closed.php +++ b/resources/events/issues/closed.php @@ -11,6 +11,6 @@ $message .= "šŸ™‹ Assignee: issue->assignee->html_url}\">@{$payload->issue->assignee->login}\n\n"; } -$message .= require __DIR__ . '/../partials/_body.php'; +$message .= require __DIR__ . '/partials/_body.php'; echo $message; diff --git a/resources/events/issues/action/deleted.php b/resources/events/issues/deleted.php similarity index 100% rename from resources/events/issues/action/deleted.php rename to resources/events/issues/deleted.php diff --git a/resources/events/issues/action/edited.php b/resources/events/issues/edited.php similarity index 100% rename from resources/events/issues/action/edited.php rename to resources/events/issues/edited.php diff --git a/resources/events/issues/action/locked.php b/resources/events/issues/locked.php similarity index 89% rename from resources/events/issues/action/locked.php rename to resources/events/issues/locked.php index cbedc11..a232afd 100644 --- a/resources/events/issues/action/locked.php +++ b/resources/events/issues/locked.php @@ -11,6 +11,6 @@ $message .= "šŸ™‹ Assignee: issue->assignee->html_url}\">@{$payload->issue->assignee->login}\n\n"; } -$message .= require __DIR__ . '/../partials/_body.php'; +$message .= require __DIR__ . '/partials/_body.php'; echo $message; diff --git a/resources/events/issues/action/opened.php b/resources/events/issues/opened.php similarity index 90% rename from resources/events/issues/action/opened.php rename to resources/events/issues/opened.php index 001cd5d..7279790 100644 --- a/resources/events/issues/action/opened.php +++ b/resources/events/issues/opened.php @@ -11,6 +11,6 @@ $message .= "šŸ™‹ Assignee: issue->assignee->html_url}\">@{$payload->issue->assignee->login}\n\n"; } -$message .= require __DIR__ . '/../partials/_body.php'; +$message .= require __DIR__ . '/partials/_body.php'; echo $message; diff --git a/resources/events/issues/action/pinned.php b/resources/events/issues/pinned.php similarity index 89% rename from resources/events/issues/action/pinned.php rename to resources/events/issues/pinned.php index 49eb9b9..b27ed02 100644 --- a/resources/events/issues/action/pinned.php +++ b/resources/events/issues/pinned.php @@ -11,6 +11,6 @@ $message .= "šŸ™‹ Assignee: issue->assignee->html_url}\">@{$payload->issue->assignee->login}\n\n"; } -$message .= require __DIR__ . '/../partials/_body.php'; +$message .= require __DIR__ . '/partials/_body.php'; echo $message; diff --git a/resources/events/issues/action/reopened.php b/resources/events/issues/reopened.php similarity index 90% rename from resources/events/issues/action/reopened.php rename to resources/events/issues/reopened.php index 0a20b28..ab502f9 100644 --- a/resources/events/issues/action/reopened.php +++ b/resources/events/issues/reopened.php @@ -11,6 +11,6 @@ $message .= "šŸ™‹ Assignee: issue->assignee->html_url}\">@{$payload->issue->assignee->login}\n\n"; } -$message .= require __DIR__ . '/../partials/_body.php'; +$message .= require __DIR__ . '/partials/_body.php'; echo $message; diff --git a/resources/events/issues/action/unlocked.php b/resources/events/issues/unlocked.php similarity index 89% rename from resources/events/issues/action/unlocked.php rename to resources/events/issues/unlocked.php index e39397b..41ded7d 100644 --- a/resources/events/issues/action/unlocked.php +++ b/resources/events/issues/unlocked.php @@ -11,6 +11,6 @@ $message .= "šŸ™‹ Assignee: issue->assignee->html_url}\">@{$payload->issue->assignee->login}\n\n"; } -$message .= require __DIR__ . '/../partials/_body.php'; +$message .= require __DIR__ . '/partials/_body.php'; echo $message; diff --git a/resources/events/issues/action/unpinned.php b/resources/events/issues/unpinned.php similarity index 89% rename from resources/events/issues/action/unpinned.php rename to resources/events/issues/unpinned.php index 1af4a41..c544a4d 100644 --- a/resources/events/issues/action/unpinned.php +++ b/resources/events/issues/unpinned.php @@ -11,6 +11,6 @@ $message .= "šŸ™‹ Assignee: issue->assignee->html_url}\">@{$payload->issue->assignee->login}\n\n"; } -$message .= require __DIR__ . '/../partials/_body.php'; +$message .= require __DIR__ . '/partials/_body.php'; echo $message; diff --git a/resources/events/push/default.php b/resources/events/push/default.php index 32364c2..7ff90f1 100644 --- a/resources/events/push/default.php +++ b/resources/events/push/default.php @@ -13,4 +13,6 @@ $message .= "url}\">{$commitId}: {$commit->message} - by {$commit->author->name}\n"; } -$message .= "\n šŸ‘¤ Pushed by : {$payload->pusher->name}\n"; +$message .= "\nšŸ‘¤ Pushed by : {$payload->pusher->name}\n"; + +echo $message; diff --git a/resources/events/workflow_job/completed.php b/resources/events/workflow_job/completed.php new file mode 100644 index 0000000..84ae4a3 --- /dev/null +++ b/resources/events/workflow_job/completed.php @@ -0,0 +1,12 @@ +Action Completed from repository->html_url}\">{$payload->repository->full_name} \n\n"; + +$message .= "Done action: šŸŽ‰ {$payload->workflow_job->runner_name} āœØ \n\n"; + +$message .= "šŸ”— Link: workflow_job->html_url}\">{$payload->workflow_job->html_url}\n\n"; + +echo $message; diff --git a/resources/events/workflow_job/in_progress.php b/resources/events/workflow_job/in_progress.php new file mode 100644 index 0000000..3433858 --- /dev/null +++ b/resources/events/workflow_job/in_progress.php @@ -0,0 +1,12 @@ +Action in progress from repository->html_url}\">{$payload->repository->full_name} \n\n"; + +$message .= "Running action: šŸ’„ {$payload->workflow_job->runner_name} ā³\n\n"; + +$message .= "šŸ”— Link: workflow_job->html_url}\">{$payload->workflow_job->html_url}\n\n"; + +echo $message; diff --git a/resources/events/workflow_run/completed.php b/resources/events/workflow_run/completed.php new file mode 100644 index 0000000..0fd4744 --- /dev/null +++ b/resources/events/workflow_run/completed.php @@ -0,0 +1,14 @@ +Workflow Completed from repository->html_url}\">{$payload->repository->full_name} \n\n"; + +$message .= "Done workflow: šŸŽ‰ {$payload->workflow_run->name} āœØ \n\n"; + +$message .= "šŸ“¤ Commit: {$payload->workflow_run->head_commit->message}\n"; + +$message .= "šŸ”— Link: workflow_run->html_url}\">{$payload->workflow_run->runner_id}\n\n"; + +echo $message; diff --git a/resources/events/workflow_run/requested.php b/resources/events/workflow_run/requested.php new file mode 100644 index 0000000..06d40c9 --- /dev/null +++ b/resources/events/workflow_run/requested.php @@ -0,0 +1,14 @@ +Workflow Requested from repository->html_url}\">{$payload->repository->full_name} \n\n"; + +$message .= "Running workflow: šŸ’„ {$payload->workflow_run->name} ā³\n\n"; + +$message .= "šŸ“¤ Commit: {$payload->workflow_run->head_commit->message}\n"; + +$message .= "šŸ”— Link: workflow_run->html_url}\">{$payload->workflow_run->runner_id}\n\n"; + +echo $message; diff --git a/src/Services/NotificationService.php b/src/Services/NotificationService.php index 0ef3894..9f57fa4 100644 --- a/src/Services/NotificationService.php +++ b/src/Services/NotificationService.php @@ -56,7 +56,10 @@ public function setPayload(Request $request): void public function setMessage(string $typeEvent): void { if (isset($this->payload->action) && !empty($this->payload->action)) { - $this->message = get_event_template($typeEvent . '.action.' . $this->payload->action, ['payload' => $this->payload]); + $this->message = get_event_template( + $typeEvent . '.' . $this->payload->action, + ['payload' => $this->payload] + ); } else { $this->message = get_event_template($typeEvent . '.default', ['payload' => $this->payload]); } @@ -77,7 +80,8 @@ public function sendNotify(string $chatId, string $message = null): bool } $method_url = 'https://api.telegram.org/bot' . config('telegram-bot.token') . '/sendMessage'; - $url = $method_url . '?chat_id=' . $chatId . '&disable_web_page_preview=1&parse_mode=html&text=' . urlencoded_message($this->message); + $url = $method_url . '?chat_id=' . $chatId . '&disable_web_page_preview=1&parse_mode=html&text=' + . urlencoded_message($this->message); $client = new Client(); $response = $client->request('GET', $url);