From 313209a06e13fe804d43cfadcf6286b85c5450f5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 29 Apr 2020 10:34:03 -0400 Subject: [PATCH] webhooks: handle lack of new refs on git push --- hubsrht/blueprints/webhooks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hubsrht/blueprints/webhooks.py b/hubsrht/blueprints/webhooks.py index 1ac4e63..e547a2f 100644 --- a/hubsrht/blueprints/webhooks.py +++ b/hubsrht/blueprints/webhooks.py @@ -63,6 +63,8 @@ def git_repo(repo_id): return "I don't recognize that repository.", 404 if event == "repo:post-update": + if not payload["refs"][0]["new"]: + return "Thanks!" commit_sha = payload["refs"][0]["new"]["id"][:7] commit_url = repo.url() + f"/commit/{commit_sha}" commit_message = payload["refs"][0]["new"]["message"].split("\n")[0]