show who opened a pull request for pull_request events when appropriate
This commit is contained in:
parent
bd176240d6
commit
2c8a94dc4c
1 changed files with 16 additions and 10 deletions
|
@ -264,13 +264,17 @@ class GitHub(object):
|
||||||
|
|
||||||
def pull_request(self, full_name, data):
|
def pull_request(self, full_name, data):
|
||||||
raw_number = data["pull_request"]["number"]
|
raw_number = data["pull_request"]["number"]
|
||||||
number = utils.irc.color("#%s" % data["pull_request"]["number"],
|
|
||||||
colors.COLOR_ID)
|
|
||||||
action = data["action"]
|
|
||||||
action_desc = "%s %s" % (action, number)
|
|
||||||
branch = data["pull_request"]["base"]["ref"]
|
branch = data["pull_request"]["base"]["ref"]
|
||||||
colored_branch = utils.irc.color(branch, colors.COLOR_BRANCH)
|
colored_branch = utils.irc.color(branch, colors.COLOR_BRANCH)
|
||||||
author = utils.irc.bold(data["sender"]["login"])
|
sender = utils.irc.bold(data["sender"]["login"])
|
||||||
|
|
||||||
|
author = utils.irc.bold(data["pull_request"]["user"]["login"])
|
||||||
|
number = utils.irc.color("#%s" % data["pull_request"]["number"],
|
||||||
|
colors.COLOR_ID)
|
||||||
|
identifier = "%s by %s" % (number, author)
|
||||||
|
|
||||||
|
action = data["action"]
|
||||||
|
action_desc = "%s %s" % (action, identifier)
|
||||||
|
|
||||||
if action == "opened":
|
if action == "opened":
|
||||||
action_desc = "requested %s merge into %s" % (number,
|
action_desc = "requested %s merge into %s" % (number,
|
||||||
|
@ -278,11 +282,12 @@ class GitHub(object):
|
||||||
elif action == "closed":
|
elif action == "closed":
|
||||||
if data["pull_request"]["merged"]:
|
if data["pull_request"]["merged"]:
|
||||||
action_desc = "%s %s into %s" % (
|
action_desc = "%s %s into %s" % (
|
||||||
utils.irc.color("merged", colors.COLOR_POSITIVE), number,
|
utils.irc.color("merged", colors.COLOR_POSITIVE),
|
||||||
colored_branch)
|
identifier, colored_branch)
|
||||||
else:
|
else:
|
||||||
action_desc = "%s %s" % (
|
action_desc = "%s %s" % (
|
||||||
utils.irc.color("closed", colors.COLOR_NEGATIVE), number)
|
utils.irc.color("closed", colors.COLOR_NEGATIVE),
|
||||||
|
identifier)
|
||||||
elif action == "ready_for_review":
|
elif action == "ready_for_review":
|
||||||
action_desc = "marked %s ready for review" % number
|
action_desc = "marked %s ready for review" % number
|
||||||
elif action == "synchronize":
|
elif action == "synchronize":
|
||||||
|
@ -310,12 +315,13 @@ class GitHub(object):
|
||||||
outputs[i] = "[PR] %s" % output
|
outputs[i] = "[PR] %s" % output
|
||||||
return outputs
|
return outputs
|
||||||
elif action == "labeled":
|
elif action == "labeled":
|
||||||
action_desc = "labled %s as '%s'" % (number, data["label"]["name"])
|
action_desc = "labled %s as '%s'" % (
|
||||||
|
identifier, data["label"]["name"])
|
||||||
|
|
||||||
pr_title = data["pull_request"]["title"]
|
pr_title = data["pull_request"]["title"]
|
||||||
url = self._short_url(data["pull_request"]["html_url"])
|
url = self._short_url(data["pull_request"]["html_url"])
|
||||||
return ["[PR] %s %s: %s - %s" % (
|
return ["[PR] %s %s: %s - %s" % (
|
||||||
author, action_desc, pr_title, url)]
|
sender, action_desc, pr_title, url)]
|
||||||
|
|
||||||
def pull_request_review(self, full_name, data):
|
def pull_request_review(self, full_name, data):
|
||||||
if not data["action"] == "submitted":
|
if not data["action"] == "submitted":
|
||||||
|
|
Loading…
Reference in a new issue