Skip to content

Commit

Permalink
Add OpenTTD#15: support notifications about pull-request-review
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain committed Oct 6, 2018
1 parent 58851d2 commit e2b7d2b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions dorpsgek_github/modules/watcher/pull_request.py
Expand Up @@ -95,3 +95,29 @@ async def issue_comment(event, github_api):
action="comment",
pull_id=pull_id,
title=title)


@github.register("pull_request_review")
async def pull_request_review(event, github_api):
repository_name = event.data["repository"]["full_name"]
pull_id = event.data["pull_request"]["number"]
title = event.data["pull_request"]["title"]
url = event.data["review"]["html_url"]
user = event.data["sender"]["login"]
action = event.data["action"]

if action == "submitted":
action = event.data["review"]["state"]

if action not in ("dismissed", "approved", "commented", "changes_requested"):
return

ref = event.data["pull_request"]["base"]["ref"]

await _notify(github_api, ref,
repository_name=repository_name,
user=user,
url=url,
action=action,
pull_id=pull_id,
title=title)

0 comments on commit e2b7d2b

Please sign in to comment.