diff options
| author | 2019-06-28 06:51:58 +0100 | |
|---|---|---|
| committer | 2019-06-28 06:51:58 +0100 | |
| commit | 1e30e76cadea948bd710d523145ab9790c72a65b (patch) | |
| tree | 7cb30dc248db8b0ce2bdc2f65a22e1ae3e89247a /modules/git_webhooks | |
| parent | channel-only,require-mode,require-access -> channel_only,require_mode,require... (diff) | |
| signature | ||
only create a range url when we have commits
Diffstat (limited to 'modules/git_webhooks')
| -rw-r--r-- | modules/git_webhooks/github.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/git_webhooks/github.py b/modules/git_webhooks/github.py index 777e8ca8..7e3db56b 100644 --- a/modules/git_webhooks/github.py +++ b/modules/git_webhooks/github.py @@ -184,13 +184,17 @@ class GitHub(object): branch = utils.irc.color(branch, colors.COLOR_BRANCH) author = utils.irc.bold(data["pusher"]["name"]) - first_id = data["before"] - last_id = data["commits"][-1]["id"] - range_url = self._short_url( - COMMIT_RANGE_URL % (full_name, first_id, last_id)) + range_url = None + if len(data["commits"]): + first_id = data["before"] + last_id = data["commits"][-1]["id"] + range_url = self._short_url( + COMMIT_RANGE_URL % (full_name, first_id, last_id)) + + single_url = COMMIT_URL % (full_name, "%s"), return self._format_push(branch, author, data["commits"], - data["forced"], COMMIT_URL % (full_name, "%s"), range_url) + data["forced"], single_url, range_url) def _format_push(self, branch, author, commits, forced, single_url, range_url): |
