webhooks: handle lack of new refs on git push

This commit is contained in:
Drew DeVault 2020-04-29 10:34:03 -04:00
parent 0d196d8602
commit 313209a06e
1 changed files with 2 additions and 0 deletions

View File

@ -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]