forked from OCA/oca-github-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
on_command.py
20 lines (16 loc) · 734 Bytes
/
on_command.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Copyright (c) initOS GmbH 2019
# Distributed under the MIT License (http://opensource.org/licenses/MIT).
from ..commands import parse_commands
from ..router import router
@router.register("issue_comment", action="created")
async def on_command(event, gh, *args, **kwargs):
"""On pull request review, tag if approved or ready to merge."""
if not event.data["issue"].get("pull_request"):
# ignore issue comments
return
org, repo = event.data["repository"]["full_name"].split("/")
pr = event.data["issue"]["number"]
username = event.data["comment"]["user"]["login"]
text = event.data["comment"]["body"]
for command in parse_commands(text):
command.delay(org, repo, pr, username)