larahook/gitlab-notification

通过Telegram机器人实现Webhook gitlab通知

v1.0.4 2024-03-05 09:58 UTC

This package is auto-updated.

Last update: 2024-09-07 13:32:27 UTC


README

通过Telegram机器人实现Gitlab通知

example

安装

composer create-project larahook/gitlab-notification

运行项目

将频道和机器人属性添加到项目.env文件中

将.env.example文件复制到.env

cp .env.example .env

更新配置

# Telegram
TELEGRAM_BOT_HOST=https://api.telegram.org/bot
TELEGRAM_BOT_TOKEN=bot_id:token
TELEGRAM_BOT_TIMEOUT=7
TELEGRAM_HASH_CHAT_IDS=some_hash_1:-1001234567890;some_hash_2:some_chat_id_2

# Outgoing Rate limiter: 20rpm
RATE_LIMITER_ALLOW=20
RATE_LIMITER_EVERY_SECONDS=60
RATE_LIMITER_RELEASE_AFTER_SECONDS=15

# Host settings
APP_HTTP_PORT=3003

Docker

docker-compose up -d
docker exec -it gitlab-notification-app composer install
docker exec -it gitlab-notification-app php artisan migrate

Gitlab

允许向本地网络发送请求

  • 管理区域 -> 设置 -> 网络 -> 出站请求
[x] Allow requests to the local network from webhooks and integrations

将URL添加到Gitlab Webhook设置

  • 设置 -> Webhooks -> 添加新的Webhook

Webhook URL示例

http://host:3003/api/v1/webhook/some_hash_1

webhook