diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..629b83a --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: python main.py diff --git a/README.md b/README.md index 523ca13..3b32d99 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ conflicts. 3. Format and send the text to a Telegram chat through "sendMessage" method of Telegram Bot API (`GET` request) +### Heroku + +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/dashezup/github-webhook-to-telegram) + ### Setup You need a Telegram bot token, create a Telegram bot with diff --git a/app.json b/app.json new file mode 100644 index 0000000..ab0af3a --- /dev/null +++ b/app.json @@ -0,0 +1,20 @@ +{ + "name": "GitHub Webhook to Telegram", + "description": "Receive GitHub webhook events and send to Telegram chats with AIOHTTP through Telegram Bot API", + "repository": "https://github.com/dashezup/github-webhook-to-telegram", + "keywords": [ + "github", + "webhooks", + "telegram", + "aiohttp", + "python", + "telegram-bot", + "telegram-bot-api" + ], + "env": { + "HOOK_CONFIG": { + "description": "configuration in JSON format, check README and config_sample.json", + "required": true + } + } +} diff --git a/config.py b/config.py index b28175f..1ed6153 100644 --- a/config.py +++ b/config.py @@ -3,10 +3,11 @@ from os import environ if environ.get('DYNO'): data = json.loads(environ.get("HOOK_CONFIG")) + PORT = int(environ.get('PORT')) else: with open("config.json") as f: data = json.load(f) + PORT = data.get('port') BOT_TOKEN = data['bot_token'] -PORT = data.get('port') GH_WEBHOOKS = data['gh_webhooks'] diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..8766529 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.9.4