[enh] handle branch deletion situation

This commit is contained in:
Laurent Peuch 2019-02-06 23:12:11 +01:00
parent b58e5b962e
commit a8147aa21c

View file

@ -79,7 +79,7 @@ async def github(request):
commit_message = commit_message[120:] + "..." commit_message = commit_message[120:] + "..."
notify(f"[{repository}] @{user} pushed {len(commits)} commit to {branch}: {commit_message} {url}", repository=repository) notify(f"[{repository}] @{user} pushed {len(commits)} commit to {branch}: {commit_message} {url}", repository=repository)
else: elif len(commits) > 1:
url = request.json["compare"] url = request.json["compare"]
notify(f"[{repository}] @{user} pushed {len(commits)} commits to {branch}: {url}", repository=repository) notify(f"[{repository}] @{user} pushed {len(commits)} commits to {branch}: {url}", repository=repository)
for commit in commits[-5:]: for commit in commits[-5:]:
@ -90,6 +90,8 @@ async def github(request):
commit_message = commit_message[120:] + "..." commit_message = commit_message[120:] + "..."
notify(f"[{repository}/{branch}] {commit_message} - {author}", repository=repository) 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 # https://developer.github.com/v3/activity/events/types/#commitcommentevent
elif hook_type == "commit_comment": elif hook_type == "commit_comment":