This repository contains a bot that receives webhook events from GitHub and posts them into messenger groups.
Prerequisites:
- Your private GitHub webhook secret (should be long, can be anything)
- GitHub Personal Access Token with scopes (
repo
andadmin:org_hook
) of a user having administrative permissions on an organization - Publicly routeable TCP port for the webhook server
- Telegram Bot Token
- Two Telegram groups where the bot is invited to
- Matrix Access Token
- Two Matrix groups where the bot is invited to
Fill in the missing values and save as .env
file:
GITHUB_WEBHOOK_HOST=*
GITHUB_WEBHOOK_PORT=80
GITHUB_WEBHOOK_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GITHUB_ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GITHUB_ORGANIZATION=xxxxx
GITHUB_FORKABLE_REPOSITORIES=xxx,xxxxxxxx,xxxxxxxx
GITHUB_WEBHOOK_URL=https://xxxxxxxxxxxxxxxxxxxxxx/
TELEGRAM_BOT_TOKEN=xxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TELEGRAM_CHAT_ID_DISCUSSIONS=-1234567890
TELEGRAM_CHAT_ID_PUSHES=-1234567890
MATRIX_HOMESERVER=https://matrix-client.matrix.org
MATRIX_USER_ID=@xxxxxxxx:matrix.org
MATRIX_DEVICE_ID=xxxxxxxxxx
MATRIX_ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MATRIX_ROOM_ID_DISCUSSIONS=!xxxxxxxxxxxxxxxxxx:matrix.org
MATRIX_ROOM_ID_PUSHES=!xxxxxxxxxxxxxxxxxx:matrix.org
LOGGING_LEVEL=DEBUG
The Matrix access token and device ID can be generated by executing bot-login
(available by installing this repository with pip
).
Convenience one-liner for loading the .env
file into your environment:
set -o allexport; source .env; set +o allexport
Developing in this repository follows the general workflow for developing Python modules (e.g. pip install --editable ./
). For testing webhooks, you may need to expose a TCP port of your development machine s.t. GitHub can send you webhooks.