Skip to content

Commit

Permalink
src/webhooks.py: Include result of GitHub pull request in pull_reques…
Browse files Browse the repository at this point in the history
…t_review_submitted hook
  • Loading branch information
cbrxyz committed Sep 27, 2024
1 parent 9bc4c44 commit fef9b2f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fef9b2f

Please sign in to comment.