Skip to content

Commit

Permalink
Merge pull request #94 from tanhongit/feature/gitlab-combine
Browse files Browse the repository at this point in the history
Feature/gitlab combine
  • Loading branch information
tanhongit authored Aug 26, 2023
2 parents 1cc5950 + f79c3fe commit 7ccec2e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
8 changes: 2 additions & 6 deletions config/jsons/gitlab-event.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"note": {
"issue": true,
"merge_request": true,
"snippet": false,
"commit": false
"commit": false,
"snippet": false
},
"merge_request": {
"open": true,
Expand All @@ -33,9 +33,5 @@
"release": {
"create": true,
"update": false
},
"emoji": {
"award": true,
"revoke": false
}
}
13 changes: 12 additions & 1 deletion resources/events/gitlab/note/commit.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<?php
/**
* @var $payload mixed
*/

$message = "💬 <b>New Comment on Commit</b> - 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}</a> by <b>{$payload->user->name}</b>\n\n";

// comment issue in gitlab
$message .= "⚙️ <b>{$payload->commit->message}</b> \n\n";

$message .= "🔗 View Comment: <a href=\"{$payload->object_attributes->url}\">{$payload->commit->id}</a> \n\n";

$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';

echo $message;
2 changes: 1 addition & 1 deletion resources/events/gitlab/note/issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

$message = "💬 <b>New Comment on Issue</b> - 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}#{$payload->issue->iid}</a> by <b>{$payload->user->name}</b>\n\n";

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

$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';

Expand Down
14 changes: 14 additions & 0 deletions resources/events/gitlab/note/snippet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* @var $payload mixed
*/

$message = "💬 <b>New Comment on Snippet</b> - 🦊<a href=\"{$payload->object_attributes->url}\">{$payload->project->path_with_namespace}</a> by <b>{$payload->user->name}</b>\n\n";

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

$message .= "🔗 <a href=\"{$payload->object_attributes->url}\">View Comment</a> \n\n";

$message .= require __DIR__ . '/../../shared/partials/gitlab/_body.php';

echo $message;
2 changes: 1 addition & 1 deletion src/Services/EventService.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getActionOfEvent($payload): string
?? '';

if (!empty($action)) {
return ($action);
return convert_action_name($action);
}

return '';
Expand Down

0 comments on commit 7ccec2e

Please sign in to comment.