def handle_gh_pull_request_comment(self, evt): if evt.is_part_of_review or evt.action != 'created': return self.bot.say('[%s] %s commented on #%s %s: %s' % (Tags.UnderlinePink(evt.repo), self.format_nickname(evt.author), evt.id, evt.hash[:6], Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_gh_pull_request_review(self, evt): # GitHub sends a review event in addition to a review comment event # when someone replies to an earlier comment or adds a single comment, # even when they didn't really submit a pull request review. # To prevent useless notifications, we skip any "review" which only has # one comment, since there is already a comment notification for those. if len(evt.comments) == 1 and \ evt.comments[0].created_at == evt.comments[0].updated_at: return if evt.state == 'pending': return if evt.action == 'submitted' and evt.state == 'approved': action = 'approved' if len(evt.comments) != 0: action += ' and commented on' elif evt.action == 'submitted' and evt.state == 'commented': action = 'reviewed and commented on' elif evt.action == 'submitted' and evt.state == 'changes_requested': action = 'requested changes to' elif evt.state == 'dismissed': action = 'dismissed their review on' else: action = '%s review on' % evt.action self.bot.say( '[%s] %s %s pull request #%s (%s): %s' % (Tags.UnderlinePink(evt.repo), self.format_nickname( evt.author), action, evt.pr_id, evt.pr_title, Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_gh_pull_request(self, evt): self.bot.say( '[%s] %s %s pull request #%d: %s (%s...%s): %s' % (Tags.UnderlinePink(evt.repo), self.format_nickname( evt.author), evt.action, evt.id, evt.title, Tags.Purple(evt.base_ref_name), Tags.Purple(evt.head_ref_name), Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_gh_issue_comment(self, evt): if evt.author == cfg.github.account.login: return self.bot.say('[%s] %s commented on #%s (%s): %s' % (Tags.UnderlinePink(evt.repo), self.format_nickname(evt.author), evt.id, evt.title, Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_gh_issue_comment(self, evt): if evt.author == cfg.github.account.login: return if evt.action == 'created': action = 'commented on' else: action = '%s a comment on' % evt.action self.bot.say('[%s] %s %s #%s (%s): %s' % ( Tags.UnderlinePink(evt.repo), self.format_nickname(evt.author), action, evt.id, evt.title, Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_build_status_settled(self, evts): per_shortrev = {} for evt in evts: per_shortrev.setdefault(evt.shortrev, []).append(evt) for shortrev, evts in per_shortrev.items(): builders = [evt.service for evt in evts] builders.sort() evt = evts[0] if evt.pr is not None: shortrev = '#%s' % evt.pr self.bot.say('[%s] build for %s %s on builders [%s]: %s' % (Tags.UnderlinePink(evt.repo), shortrev, Tags.Red('failed'), ', '.join(builders), Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_gh_pull_request(self, evt): action = evt.action if action == 'synchronize': action = 'synchronized' elif action == 'review_requested': action = 'requested a review from %s for' % ', '.join([user.login for user in evt.requested_reviewers]) elif action == 'review_request_removed': action = 'dismissed a review request on' elif action == 'closed' and evt.merged: action = 'merged' self.bot.say('[%s] %s %s pull request #%d: %s (%s...%s): %s' % ( Tags.UnderlinePink(evt.repo), self.format_nickname(evt.author), action, evt.id, evt.title, Tags.Purple(evt.base_ref_name), Tags.Purple(evt.head_ref_name), Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_gh_commit_comment(self, evt): self.bot.say('[%s] %s commented on commit %s: %s' % ( Tags.UnderlinePink(evt.repo), self.format_nickname(evt.author), evt.commit, Tags.UnderlineBlue(utils.shorten_url(evt.url))))
def handle_gh_pull_request_comment(self, evt): self.bot.say('[%s] %s commented on #%s %s: %s' % (Tags.UnderlinePink(evt.repo), self.format_nickname(evt.author), evt.id, evt.hash[:6], Tags.UnderlineBlue(utils.shorten_url(evt.url))))