Skip to content

Commit 27129d8

Browse files
committed
fix: ensure message is not empty and replace new lines for the push github event
1 parent 55e3884 commit 27129d8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

resources/views/events/github/push/default.blade.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
$ref = explode('/', $payload->ref);
1010
$branch = implode('/', array_slice($ref, 2));
1111
12-
$type = 'default';
12+
if (empty($payload->commits)) {
13+
return '';
14+
}
1315
?>
1416

1517
👷⚙️ {!! __('tg-notifier::events/github/push.default.title', [
@@ -21,9 +23,12 @@
2123
) !!}
2224

2325
@foreach($payload->commits as $commit)
24-
@php
25-
$commitId = substr($commit->id, -7);
26-
@endphp
26+
@php
27+
$commitId = substr($commit->id, -7);
28+
29+
$commit->message = $commit->message ?? '';
30+
$commit->message = str_replace("\n", '', $commit->message);
31+
@endphp
2732
{!! __('tg-notifier::events/github/push.default.commit', [
2833
'commit' => "<a href='$commit->url'>$commitId</a>",
2934
'commit_message' => $commit->message,

0 commit comments

Comments
 (0)