aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2019-01-10 13:18:58 +0000
committerGravatar jesopo2019-01-10 13:18:58 +0000
commitd26a945c49020c7c117787b824a3acca9f10814c (patch)
tree43f3b0dc380a85daf7cf3d098aaed6fa5f79c6da /modules
parentrpartition (instead of partition) #number for github issues/pull, so that we (diff)
signature
Show an error if !ghissue or !ghpull doesn't find the specified issue/pr
(github.py)
Diffstat (limited to 'modules')
-rw-r--r--modules/github.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/github.py b/modules/github.py
index c05ef99f..de1ad5cd 100644
--- a/modules/github.py
+++ b/modules/github.py
@@ -60,13 +60,15 @@ class Module(ModuleManager.BaseModule):
page = utils.http.request(
API_ISSUE_URL % (username, repository, number),
json=True)
- if page:
+ if page and page.code == 200:
labels = [label["name"] for label in page.data["labels"]]
url = self._short_url(page.data["html_url"])
event["stdout"].write("(%s/%s issue#%s) %s [%s] %s" % (
username, repository, number, page.data["title"],
", ".join(labels), url))
+ else:
+ event["stderr"].write("Could not find issue")
@utils.hook("received.command.ghpull", min_args=1)
def github_pull(self, event):
@@ -76,7 +78,7 @@ class Module(ModuleManager.BaseModule):
page = utils.http.request(
API_PULL_URL % (username, repository, number),
json=True)
- if page:
+ if page and page.code == 200:
repo_from = page.data["head"]["label"]
repo_to = page.data["base"]["label"]
added = self._added(page.data["additions"])
@@ -87,6 +89,8 @@ class Module(ModuleManager.BaseModule):
"(%s/%s pull#%s) [%s/%s] %s→%s - %s %s" % (
username, repository, number, added, removed,
repo_from, repo_to, page.data["title"], url))
+ else:
+ event["stderr"].write("Could not find pull request")
@utils.hook("api.post.github")
def webhook(self, event):