From 3fad302b40f81209c66524cc367bb3ecede85f59 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sat, 3 Feb 2024 01:02:13 +0700 Subject: [PATCH 1/6] remove redundant script in composer --- composer.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/composer.json b/composer.json index bc35369..f61fe6a 100644 --- a/composer.json +++ b/composer.json @@ -51,13 +51,7 @@ }, "scripts": { "analyse": "vendor/bin/phpstan analyse", - "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes", - "post-install-cmd": [ - "bash vendor/cslant/telegram-git-notifier/install.sh" - ], - "post-update-cmd": [ - "bash vendor/cslant/telegram-git-notifier/install.sh" - ] + "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes" }, "support": { "issues": "https://github.com/cslant/laravel-telegram-git-notifier/issues" From bb0834affe1ee8c45bc4729a34db07b613071a6f Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Mon, 5 Feb 2024 22:19:29 +0700 Subject: [PATCH 2/6] docs: update readme --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0850f47..7146049 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,11 @@ ## 📝 Introduction -Laravel Telegram Git Notifier is a package that allows you to create a Telegram bot to receive notifications from GitHub or GitLab events and manage customization through messages and buttons on Telegram. +Laravel Telegram Git Notifier is a package that allows you to create a Telegram bot to receive notifications from GitHub +or GitLab events and manage customization through messages and buttons on Telegram. -- Send notifications of your GitHub/GitLab repositories to Telegram Bots, Groups, Super Groups (Multiple Topics), and Channels. +- Send notifications of your GitHub/GitLab repositories to Telegram Bots, Groups, Super Groups (Multiple Topics), and + Channels. - The bot must be created using the [BotFather](https://core.telegram.org/bots#6-botfather) ## 📋 Requirements @@ -35,11 +37,52 @@ You can install this package via Composer: composer require cslant/laravel-telegram-git-notifier ``` +## 🚀 Usage + +See the [Usage - Telegram git notifier Documentation](https://docs.cslant.com/telegram-git-notifier/usage/first_test) +for a list of usage. + Please check and update some configurations in the documentation. ## 📖 Official Documentation -Please see the [Telegram Git Notifier Documentation](https://docs.cslant.com/telegram-git-notifier/) for more information. +Please see the [Telegram Git Notifier Documentation](https://docs.cslant.com/telegram-git-notifier/) for more +information. + +## ✨ Supported events + +### GitHub Events Available + +- [x] Push +- [x] Issues +- [x] Issue Comment +- [x] Pull Request +- [x] Pull Request Review +- [x] Pull Request Review Comment +- [x] Fork +- [x] Commit Comment +- [x] Deployment +- [x] Deployment Status +- [x] Fork +- [x] Gollum +- [x] Watch + + ... and more events can see in the [all GitHub events available](https://docs.cslant.com/telegram-git-notifier/) + +### GitLab Events Available + +- [x] Push +- [x] Tag Push +- [x] Issue +- [x] Merge Request +- [x] Note +- [x] Pipeline +- [x] Wiki Page +- [x] Build +- [x] Deployment +- [x] Release + + ... and more events can see in the [all GitLab events available](https://docs.cslant.com/telegram-git-notifier/) ## License From 603c064b47bd48276fc262e1b318a4ce21c43a2a Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Mon, 12 Feb 2024 22:34:01 +0700 Subject: [PATCH 3/6] Auto-detect and set permission for Json files --- src/Commands/ChangeOwnerConfigJson.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Commands/ChangeOwnerConfigJson.php b/src/Commands/ChangeOwnerConfigJson.php index 41a084c..bd0d21b 100644 --- a/src/Commands/ChangeOwnerConfigJson.php +++ b/src/Commands/ChangeOwnerConfigJson.php @@ -12,7 +12,7 @@ class ChangeOwnerConfigJson extends Command * @var string */ protected $signature = 'config-json:change-owner - {user : The user to change owner} + {user? : The user to change owner} {group? : The group to change owner}'; /** @@ -29,12 +29,23 @@ class ChangeOwnerConfigJson extends Command */ public function handle(): void { - $user = $this->argument('user'); + if (PHP_OS_FAMILY !== 'Linux') { + $this->error('This command only works on Linux'); + return; + } + + $user = $this->argument('user') ?? ''; $group = $this->argument('group') ?? $user; + if (empty($user) || empty($group)) { + $group = $user = exec('ps aux | egrep "(apache|httpd|nginx)" | grep -v "root" | head -n1 | cut -d\ -f1'); + } + $jsonsPath = config('telegram-git-notifier.data_file.storage_folder'); if (is_string($jsonsPath) && file_exists($jsonsPath)) { - exec("chown -R $user:$group $jsonsPath"); + shell_exec("chown -R $user:$group $jsonsPath"); + } else { + $this->error('The path to the jsons folder is not valid'); } } } From 68ca5632b4a455c9312d92c7373abd24593cf9ee Mon Sep 17 00:00:00 2001 From: tanhongit Date: Mon, 12 Feb 2024 15:34:25 +0000 Subject: [PATCH 4/6] Fix styling --- src/Commands/ChangeOwnerConfigJson.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Commands/ChangeOwnerConfigJson.php b/src/Commands/ChangeOwnerConfigJson.php index bd0d21b..5f82f9a 100644 --- a/src/Commands/ChangeOwnerConfigJson.php +++ b/src/Commands/ChangeOwnerConfigJson.php @@ -31,6 +31,7 @@ public function handle(): void { if (PHP_OS_FAMILY !== 'Linux') { $this->error('This command only works on Linux'); + return; } From 527ed481d5c5f64e88b294e211042fc2595e5ff0 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Thu, 15 Feb 2024 16:13:56 +0700 Subject: [PATCH 5/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7146049..a69e9bd 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ information. - [x] Gollum - [x] Watch - ... and more events can see in the [all GitHub events available](https://docs.cslant.com/telegram-git-notifier/) + ... and more events can be seen in the [all GitHub events available](https://docs.cslant.com/telegram-git-notifier/prologue/event-availability/github) ### GitLab Events Available @@ -82,7 +82,7 @@ information. - [x] Deployment - [x] Release - ... and more events can see in the [all GitLab events available](https://docs.cslant.com/telegram-git-notifier/) + ... and more events can be seen in the [all GitLab events available](https://docs.cslant.com/telegram-git-notifier//prologue/event-availability/gitlab) ## License From 2d01ee2ff30c05156a128c8ab1a5c6ed8f7c56e3 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Thu, 15 Feb 2024 17:10:08 +0700 Subject: [PATCH 6/6] Update custom_event.blade.php --- resources/views/tools/custom_event.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/tools/custom_event.blade.php b/resources/views/tools/custom_event.blade.php index 52eefe8..f7c7ece 100644 --- a/resources/views/tools/custom_event.blade.php +++ b/resources/views/tools/custom_event.blade.php @@ -5,7 +5,7 @@ $docsUrl = 'https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads'; if ($platform === 'gitlab') { - $docsUrl = 'https://docs.gitlab.com/ee/user/project/integrations/webhooks.html'; + $docsUrl = 'https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html'; } $documentation = __('tg-notifier::tools/custom_event.documentation'); ?>