From fef9b2fb5a43ac86b4b19f35ecf4a0d06f09d1ea Mon Sep 17 00:00:00 2001 From: Cameron Brown Date: Fri, 27 Sep 2024 14:16:03 -0400 Subject: [PATCH] src/webhooks.py: Include result of GitHub pull request in pull_request_review_submitted hook --- src/webhooks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/webhooks.py b/src/webhooks.py index 1e58e8c..597d6bc 100644 --- a/src/webhooks.py +++ b/src/webhooks.py @@ -314,8 +314,16 @@ async def pull_request_review_submitted(self, payload: ClientPayload): pr = f"[#{gh['pull_request']['number']}]({self.url(gh['pull_request'], html=True)})" repo = f"[{gh['repository']['full_name']}]({self.url(gh['repository'], html=True)})" updates_channel = self.updates_channel(gh["repository"]) + action_statement = "submitted a review on" + if gh["review"]["state"] == "changes_requested": + action_statement = "requested changes on" + elif gh["review"]["state"] == "approved": + action_statement = "approved" + elif gh["review"]["state"] == "commented": + action_statement = "commented on" + await updates_channel.send( - f"{name} submitted a review on pull request {pr} in {repo}", + f"{name} {action_statement} pull request {pr} in {repo}", ) @Server.route()