Move configuration from config.py to config.json and add support for GitHub organization webhooks
remove _format_watch() from utils.github_webhook as the value of watchers_count is always identical with stargazers_count https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#watch https://developer.github.com/changes/2012-09-05-watcher-api/
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
"""
|
||||
import asyncio
|
||||
from typing import Union
|
||||
|
||||
from aiohttp import web, ClientSession
|
||||
from aiohttp.web_request import Request
|
||||
@@ -39,10 +40,10 @@ async def main(_):
|
||||
|
||||
@routes.post("/")
|
||||
async def github_webhook_post_handler(request: Request) -> Response:
|
||||
valid_github_webhook = await validate_github_webhook(request)
|
||||
if not valid_github_webhook:
|
||||
tg_chat_id: Union[str, int, bool] = await validate_github_webhook(request)
|
||||
if not tg_chat_id:
|
||||
return web.Response(status=403, text="403: Forbidden")
|
||||
tg_status = await send_to_telegram(session, request)
|
||||
tg_status = await send_to_telegram(session, tg_chat_id, request)
|
||||
return web.Response(text=f"Send to Telegram: {tg_status}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user