From f6cb50d374b01df10021f9a5e7f880bc75ac44f4 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 17 Aug 2024 09:50:46 +0000 Subject: [PATCH] Fix webhooks: they should return response.empty (no error) on github_post if it's not a valid PR --- webhooks/requirements.txt | 9 +++++++++ webhooks/webhook.py | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 webhooks/requirements.txt diff --git a/webhooks/requirements.txt b/webhooks/requirements.txt new file mode 100644 index 0000000..9640b65 --- /dev/null +++ b/webhooks/requirements.txt @@ -0,0 +1,9 @@ +jinja2 +sanic==21.12.2 +GitPython +pyyaml +toml +websockets==10.0 +babel +langcodes +language_data diff --git a/webhooks/webhook.py b/webhooks/webhook.py index 239951f..2796ecb 100755 --- a/webhooks/webhook.py +++ b/webhooks/webhook.py @@ -73,6 +73,8 @@ async def github_post(request: Request) -> HTTPResponse: if valid_pr_comment: return on_pr_comment(request, pr_infos) + else: + return response.empty() return response.json({"error": f"Unknown event '{event}'"}, 422)