From b9fa74dbb51b674e56af285442c40d1c943af817 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 7 Mar 2019 08:35:29 +0000 Subject: Move PR number into/after action for pull_request events --- modules/github/__init__.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'modules/github') diff --git a/modules/github/__init__.py b/modules/github/__init__.py index 890ec57b..7f2aa9e3 100644 --- a/modules/github/__init__.py +++ b/modules/github/__init__.py @@ -495,28 +495,30 @@ class Module(ModuleManager.BaseModule): number = utils.irc.color("#%s" % data["pull_request"]["number"], COLOR_ID) action = data["action"] - action_desc = action + action_desc = "%s %s" % (action, number) branch = data["pull_request"]["base"]["ref"] colored_branch = utils.irc.color(branch, COLOR_BRANCH) if action == "opened": - action_desc = "requested merge into %s" % colored_branch + action_desc = "requested %s merge into %s" % (number, + colored_branch) elif action == "closed": if data["pull_request"]["merged"]: - action_desc = "%s into %s" % ( - utils.irc.color("merged", COLOR_POSITIVE), + action_desc = "%s %s into %s" % ( + utils.irc.color("merged", COLOR_POSITIVE), number, colored_branch) else: - action_desc = utils.irc.color("closed without merging", - COLOR_NEGATIVE) + action_desc = "%s %s %s" % ( + utils.irc.color("closed", COLOR_NEGATIVE), number, + utils.irc.color("without merging", COLOR_NEGATIVE)) elif action == "synchronize": - action_desc = "committed to" + action_desc = "committed to %s" % number pr_title = data["pull_request"]["title"] author = utils.irc.bold(data["sender"]["login"]) url = self._short_url(data["pull_request"]["html_url"]) - return ["[PR %s] %s %s: %s - %s" % ( - number, author, action_desc, pr_title, url)] + return ["[PR] %s %s: %s - %s" % ( + author, action_desc, pr_title, url)] def pull_request_review(self, full_name, data): if data["review"]["state"] == "commented": -- cgit v1.3.1-10-gc9f91