1
0
mirror of https://github.com/pinpox/gitea-matrix-bot synced 2024-11-22 10:21:58 +01:00
A bot to post gitea events to a matrix channel
Go to file
Pablo Ovelleiro Corral 5cff409407
updated screenshot
2019-04-20 23:10:10 +02:00
.gitignore fixed db, implemented missing methods 2019-04-19 23:54:13 +02:00
.travis.yml Update .travis.yml 2019-04-18 20:37:30 +02:00
config.ini.example example config updated 2019-04-20 16:08:30 +02:00
gitea-scrot.png updated screenshot 2019-04-20 23:10:10 +02:00
giteabot.go Add flags and comments 2019-04-20 15:34:03 +02:00
giteadb_test.go removed unused methods 2019-04-20 00:00:09 +02:00
giteadb.go Add flags and comments 2019-04-20 15:34:03 +02:00
listener.go removed reset method, security concerns. Added proper logging 2019-04-20 14:59:08 +02:00
main.go Add flags and comments 2019-04-20 15:34:03 +02:00
postdata.go cleaned up postdata struct 2019-04-13 20:21:58 +02:00
README.md Update README.md 2019-04-20 23:06:44 +02:00

Build Status GoDoc Go Report Card codecov

gitea-matrix-bot

A bot to listen for gitea webhooks and post to a matrix channel

This bot was build using my bot framework. If you stumble upon bugs on any of them please let me know!

Join the support channel for help and discussion: #gitea-matrix-bot:matrix.org

Usage of the bot

If you have already an instance of this bot running somewhere or someone is already hosting it publicly (lucky you!) and just want to add it to your room, this is how to create a webhook for your repository:

  1. Invite the bot to the room you want it to post to
  2. Find your room's id. This is not the name or adress! It starts with an exclamation mark and has a format like this!DYgXKezaHgMbiPMzjX:matrix.org
  3. Use the room ID to request a token from the bot !gitea secret !DYgXKezaHgMbiPMzjX:matrix.org. You can issue this command in a different room or private chat if you want to keep it secret if the room you're adding the bot to has members that are not supposed to view the token
  4. The bot will reply to you with instructions on how to set up the gitea webhook. Set up a webhook of type gitea with the url provided and use the token as secret. Select the specific types of events you want to be notified on or select "All Events"

It will probably look like this: gitea scrot

Installation

To host the bot yourself, you will need to have a valid account on a matrix server and create a configuration file.

Copy config.ini.example to config.ini or create a file called config.ini with the following options:

[http]
# The path the listener will expect the post data
http_uri = "/post"
# The port the listener will listen on
http_port = "9000"


[matrix]
# The matrix server to connect to
matrix_host = "http://matrix.org"
# The matrix room to post to
matrix_room = "#my-awesome-room:matrix.org"
# User credentions of the bot for posting to the room
matrix_pass = "supersecretpass"
matrix_user = "my-awesome-bot"


[bot]
# Path of the database to be used
db_path = "./tokens.db"

Then start the bot. It will listen on the configured URI for incoming gitea hooks.