From 01f8144ef63e7c18e9788e5f7ca1d2f861c1a795 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam-Stewart Date: Mon, 25 Jan 2021 01:21:28 +0100 Subject: [PATCH] Add DEFAULT_REPOSITORY option --- README.md | 6 ++++++ bot.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3663e8b..069ab38 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,15 @@ # Godot Issuebot Simple bot to ferry between rocket.chat and Github. If you want to run one for yourself you can build the container. + +What does it do? It will add issue/pr links to messages that mention a valid issue. Either by typing `#1335` to go to the default repository or `repository#345` for a particular one. The bot will edit the message in question and add links, description, and status to the message. + +## Environment variables The following environment variables are supported: * `BOT_DEBUG` - Turn on exessive debug messages when set * `DEFAULT_AVATAR_URL` - *required* url to some image if gh can't provide an avatar + * `DEFAULT_REPOSITORY` - *required* default repository to search if a 'bare' issue # gets sent * `ROCKET_WS_URL` - *required* url to the rocket.chat server (wss://chat.godotengine.org/websocket) * `ROCKET_USERNAME` - *required* username of the rocket.chat user to login as * `ROCKET_PASSWORD` - *required* password of the rocket.chat user @@ -28,6 +33,7 @@ example env file: ``` BOT_DEBUG=true DEFAULT_AVATAR_URL=https://chat.godotengine.org/avatar/github +DEFAULT_REPOSITORY=godot GITHUB_PROJECT=godotengine ROCKET_WS_URL=wss://chat.godotengine.org/websocket ROCKET_USERNAME=github diff --git a/bot.py b/bot.py index 1725735..9fa088f 100755 --- a/bot.py +++ b/bot.py @@ -16,6 +16,7 @@ GITHUB_PROJECT=os.environ.get('GITHUB_PROJECT') GITHUB_USERNAME=os.environ.get('GITHUB_USERNAME') GITHUB_TOKEN=os.environ.get('GITHUB_TOKEN') DEFAULT_AVATAR_URL=os.environ.get('DEFAULT_AVATAR_URL') +DEFAULT_REPOSITORY=os.environ.get('DEFAULT_REPOSITORY') def debug_print(msg): if DEBUG: @@ -105,7 +106,7 @@ class Bot: continue if not repository: - repository = 'godot' + repository = DEFAULT_REPOSITORY debug_print(f"Message contains issue for {repository}")