From a8147aa21c1b3ed80e091d9e80b0cf1789a080b7 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 6 Feb 2019 23:12:11 +0100 Subject: [PATCH] [enh] handle branch deletion situation --- server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index bc89968..674ca8c 100644 --- a/server.py +++ b/server.py @@ -79,7 +79,7 @@ async def github(request): commit_message = commit_message[120:] + "..." notify(f"[{repository}] @{user} pushed {len(commits)} commit to {branch}: {commit_message} {url}", repository=repository) - else: + elif len(commits) > 1: url = request.json["compare"] notify(f"[{repository}] @{user} pushed {len(commits)} commits to {branch}: {url}", repository=repository) for commit in commits[-5:]: @@ -90,6 +90,8 @@ async def github(request): commit_message = commit_message[120:] + "..." notify(f"[{repository}/{branch}] {commit_message} - {author}", repository=repository) + else: + ... # case of 0 which means branch deletion # https://developer.github.com/v3/activity/events/types/#commitcommentevent elif hook_type == "commit_comment":