Skip to content

Commit

Permalink
Merge pull request #60 from tanhongit/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tanhongit committed Feb 15, 2024
2 parents 42c0991 + 2d01ee2 commit a564294
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 14 deletions.
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 be seen in the [all GitHub events available](https://docs.cslant.com/telegram-git-notifier/prologue/event-availability/github)

### 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 be seen in the [all GitLab events available](https://docs.cslant.com/telegram-git-notifier//prologue/event-availability/gitlab)

## License

Expand Down
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/tools/custom_event.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
?>
Expand Down
18 changes: 15 additions & 3 deletions src/Commands/ChangeOwnerConfigJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}';

/**
Expand All @@ -29,12 +29,24 @@ 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');
}
}
}

0 comments on commit a564294

Please sign in to comment.