Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentations and commands #60

Merged
merged 7 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

$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');
}
}
}