Skip to content

Commit

Permalink
fix: update merge request events for gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Nov 23, 2023
1 parent 5e37b8e commit 81cebcf
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 90 deletions.
29 changes: 29 additions & 0 deletions lang/en/events/gitlab/merge_request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

return [
'review' => '👥 Reviewers: ',
'closed' => [
'title' => '❌ <b>Merge Request Closed</b> - 🦊:repo by :user',
],
'merged' => [
'title' => '✅ <b>Merge Request Merged</b> - 🦊:repo by :user',
],
'opened' => [
'title' => '👷‍♂️🛠️ <b>New Merge Request</b> - 🦊:issue by :user',
],
'reopened' => [
'title' => '👷‍♂️🛠️ <b>Merge Request Reopened</b> - 🦊:issue by :user',
],
'approved' => [
'title' => '👍 <b>Merge Request Approved</b> ✅ - 🦊:issue by :user',
],
'unapproved' => [
'title' => '👎 <b>Merge Request Unapproved</b> ❌ - 🦊:issue by :user',
],
'approval' => [
'title' => '👍 <b>Merge Request Approval</b> ✅ - 🦊:issue by :user',
],
'unapproval' => [
'title' => '👎 <b>Merge Request Unapproval</b> ❌ - 🦊:issue by :user',
],
];
18 changes: 18 additions & 0 deletions resources/views/events/gitlab/merge_request/approval.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
?>
{!! __('tg-notifier::events/gitlab/merge_request.approval.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

🛠 <b>{{ $payload->object_attributes->title }}</b>

🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/approved.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "✅ <b>Merge Request Approved</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.approved.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/close.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "❌ <b>Close Merge Request</b> - 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.closed.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/merge.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "✅🎉 <b>Merge Request Merged</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.merged.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/open.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "👷‍♂️🛠️ <b>Merge Request Opened</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.opened.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
$textReviewers .= "👥 Reviewers: " . implode(', ', $reviewers) . "\n";
$textReviewers .= __('tg-notifier::events/gitlab/merge_request.review') . implode(', ', $reviewers);
}
return $textReviewers;
?>
{!! $textReviewers !!}
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/reopen.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "👷‍♂️🛠️ <b>Merge Request Reopened</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.opened.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/unapproval.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "⛔‍🛠️ <b>Merge Request Unapproved</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.unapproval.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/unapproved.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "❌ <b>Close Merge Request</b> - 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.unapproved.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))
22 changes: 11 additions & 11 deletions resources/views/events/gitlab/merge_request/update.blade.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @var $payload object
* @var $event string
*/
$message = "👷‍♂️🛠️ <b>Merge Request Updated</b> to 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a> by <b>{$payload->user->name}</b>\n\n";
?>
{!! __('tg-notifier::events/gitlab/merge_request.update.title', [
'repo' => "<a href='{$payload->object_attributes->url}'>{$payload->project->path_with_namespace}#{$payload->object_attributes->iid}</a>",
'user' => "<b>{$payload->user->name}</b>"
]) !!}

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

$message .= "🌳 {$payload->object_attributes->source_branch} -> {$payload->object_attributes->target_branch} 🎯 \n";
$message .= require __DIR__ . '/../../shared/partials/gitlab/_assignees.php';
$message .= require __DIR__ . '/partials/_reviewers.php';
$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';
echo $message;
🌳 {{ $payload->object_attributes->source_branch }} -> {{ $payload->object_attributes->target_branch }} 🎯
@include('tg-notifier::events.shared.partials.gitlab._assignees', compact('payload', 'event'))
@include('tg-notifier::events.gitlab.merge_request.partials._reviewers', compact('payload'))
@include('tg-notifier::events.shared.partials.gitlab._body', compact('payload', 'event'))

0 comments on commit 81cebcf

Please sign in to comment.