aboutsummaryrefslogtreecommitdiff
path: root/modules/github.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-01-17 17:01:12 +0000
committerGravatar jesopo2019-01-17 17:01:12 +0000
commit72d4375e5549b33c156d33175846eb6703cacba3 (patch)
treeefc46b43ad80a960819e8c7d4bc8bc6d0828ee57 /modules/github.py
parentActually use new `sender` arg for _on_notice() (print_activity.py) (diff)
signature
Only show specific actions for pull requests and issues (github.py)
Diffstat (limited to 'modules/github.py')
-rw-r--r--modules/github.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/github.py b/modules/github.py
index 6f2bf79a..e00ab410 100644
--- a/modules/github.py
+++ b/modules/github.py
@@ -43,6 +43,10 @@ COMMENT_ACTIONS = {
"deleted": "deleted a comment"
}
+ISSUE_ACTIONS = ["opened", "closed", "reopened", "edited", "deleted"]
+PULL_REQUEST_ACTIONS = ["opened", "closed", "reopened", "edited",
+ "synchronized"]
+
@utils.export("channelset", {"setting": "github-hook",
"help": ("Disable/Enable showing BitBot's github commits in the "
"current channel"), "array": True})
@@ -300,6 +304,9 @@ class Module(ModuleManager.BaseModule):
branch = data["pull_request"]["base"]["ref"]
colored_branch = utils.irc.color(branch, utils.consts.LIGHTBLUE)
+ if not action in PULL_REQUEST_ACTIONS:
+ return
+
if action == "opened":
action_desc = "requested merge into %s" % colored_branch
elif action == "closed":
@@ -312,10 +319,6 @@ class Module(ModuleManager.BaseModule):
utils.consts.RED)
elif action == "synchronize":
action_desc = "committed to"
- elif action == "labeled":
- 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"])
@@ -348,10 +351,9 @@ class Module(ModuleManager.BaseModule):
number = data["issue"]["number"]
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"]
+
+ if not action in ISSUE_ACTIONS:
+ return
issue_title = data["issue"]["title"]
author = utils.irc.bold(data["sender"]["login"])