Giter Site home page Giter Site logo

jae1911 / gh-bot Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 167 KB

The worst but simplest webhook bot for GitHub and Matrix.

License: MIT License

Dockerfile 1.25% Python 98.75%
matrix matrix-bot github github-webhooks gitlab gitlab-webhook gitea gitea-webhooks

gh-bot's Introduction

gh-bot

gh-bot is maybe the worst (but simplest) Matrix webhook bot for Github.

Example of commits: Screenshot of Element showing a list of commits sent by the bot.

Example of workflow finished: Screenshot of Element showing a workflow ended event.

Setting up

Server

You will need a secret key, generate one like this:

ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'

A user token and a Matrix homeserver URL.

Here is an example docker-compose:

version: '2.1'

services:
  image: ghcr.io/jaedotmoe/gh-bot:latest
  environment:
    - SEC_TOKEN=72f38e4c61b28f1c9a17868750f48330e47abd12dummy
    - MATRIX_TOKEN=syt_028ifji4jf82jf20983j03ijdummy
    - MATRIX_HOMESERVER=matrix.example.com
  ports:
    - 5000:5000

You can also add - LOG_ALL_EVENTS=true to the environment variables to log every event sent to webhooks to all rooms via a fi.jae.webhooklog event.

Now, you can invite the bot and it will auto-join room it is invited in every 15 seconds.

Github

Go to your Github repository setting, Webhooks and Add Webhook.
There, set these values:

  • Payload URL: Your exposed URL, for instance https://example.com/gh/webhook
  • Content type: application/json
  • Secret: your generated secret, for instance 72f38e4c61b28f1c9a17868750f48330e47abd12dummy
  • Which events would you like to trigger this webhook: Send me everything.

And then hit Add Webhook.
You are now good to go!

Gitlab

Go to your repo settings, Webhooks and fill with this data:

  • URL: your exposed URL, for instance: https://example.com/gh/gitlab
  • Secret token: your generated secret, for instance 72f38e4c61b28f1c9a17868750f48330e47abd12dummy
  • Trigger: select events you want to receive

And then click on 'Add Webhook' and there you go!

Gitea

Go to your repo settings, Webhooks, Add Webhook, Gitea:

  • Target URL: your endpoint https://example.com/gh/gitea
  • POST Content Type: application/json
  • Secret: your secret, for instance 72f38e4c61b28f1c9a17868750f48330e47abd12dummy
  • Trigger on: all events

Then click 'Add Webhook'.

Support

If you need any help, join the Matrix room.

gh-bot's People

Contributors

dependabot[bot] avatar jae1911 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gh-bot's Issues

Gitea support

A user on Matrix suggested gitea-style webhook support.

Use real bot instead of posting to API

Use a real bot instead of posting data to an endpoint.
It would be better as you would be able to invite the bot to rooms and join them automatically.

Handle MR

Send messages when someone opens a MR.

Gitlab support

A user in a Matrix room suggested to support Gitlab-type webhooks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.