From 6dc58d4ceb0b52c2094c265ddda43b5a04b3355e Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 9 Dec 2018 20:57:29 +0000 Subject: [PATCH] Correctly support labeling pull requests, support unlabeling pull requests and support both on issues --- modules/github.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/github.py b/modules/github.py index 9c6ccd13..a265a0ce 100644 --- a/modules/github.py +++ b/modules/github.py @@ -178,7 +178,9 @@ class Module(ModuleManager.BaseModule): elif action == "synchronize": action_desc = "committed to" elif action == "labeled": - action_desc = "labeled as '%s'" % data["pull_request"]["labels"][-1] + action_desc = "labeled as '%s'" % data["label"]["name"] + elif action == "unlabeled": + action_desc = "unlabeled as '%s'" % data["label"]["name"] pr_title = data["pull_request"]["title"] author = utils.irc.bold(data["sender"]["login"]) @@ -206,6 +208,12 @@ class Module(ModuleManager.BaseModule): def issues(self, event, full_name, data): action = data["action"] + action_desc = action + if action == "labeled": + action_desc = "labeled as '%s'" % data["label"]["name"] + elif action == "unlabeled": + action_desc = "unlabeled as '%s'" % data["label"]["name"] + issue_title = data["issue"]["title"] author = utils.irc.bold(data["sender"]["login"]) url = data["issue"]["html_url"]