show PRs on check_run output where possible

This commit is contained in:
jesopo 2020-10-18 00:37:05 +00:00
parent c4c6fdde1c
commit a91c03421f

View file

@ -441,6 +441,12 @@ class GitHub(object):
commit = self._short_hash(data["check_run"]["head_sha"])
commit = utils.irc.color(commit, utils.consts.LIGHTBLUE)
pr = ""
if ("pull_requests" in data["check_run"] and
data["check_run"]["pull_requests"]):
pr_num = data["check_run"]["pull_requests"][0]["number"]
pr = "/PR%s" % utils.irc.color("#%s" % pr_num, colors.COLOR_ID)
url = ""
if data["check_run"]["details_url"]:
url = data["check_run"]["details_url"]
@ -472,8 +478,8 @@ class GitHub(object):
status_str = utils.irc.color(
CHECK_RUN_CONCLUSION[conclusion], conclusion_color)
return ["[build @%s] %s: %s%s%s" % (
commit, name, status_str, duration, url)]
return ["[build @%s%s] %s: %s%s%s" % (
commit, pr, name, status_str, duration, url)]
def fork(self, full_name, data):
forker = utils.irc.bold(data["sender"]["login"])