integrations: Reformat Github pull request assigned message body.

Instead of adding the assignee to the end of the message body,
we update the message body where the verb is so that the link
formatting at the end of the message is not broken, for example:
"user_a assigned user_b to [issue #XXX title text is here](link)."

This matches the formatting for the issue assigned message body.
This commit is contained in:
Lauryn Menard
2023-11-22 16:33:57 +01:00
committed by Tim Abbott
parent f6e17fa972
commit a4d1211ec6
2 changed files with 3 additions and 3 deletions

View File

@@ -375,13 +375,13 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("pull_request__synchronized_with_body", TOPIC_PR, expected_message)
def test_pull_request_assigned_msg(self) -> None:
expected_message = "baxterthehacker assigned [PR #1](https://github.com/baxterthehacker/public-repo/pull/1) to baxterthehacker."
expected_message = "baxterthehacker assigned baxterthehacker to [PR #1](https://github.com/baxterthehacker/public-repo/pull/1)."
self.check_webhook("pull_request__assigned", TOPIC_PR, expected_message)
def test_pull_request_assigned_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker assigned [PR #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1) to baxterthehacker."
expected_message = "baxterthehacker assigned baxterthehacker to [PR #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1)."
self.check_webhook("pull_request__assigned", expected_topic, expected_message)
def test_pull_request_unassigned_msg(self) -> None:

View File

@@ -104,7 +104,7 @@ def get_assigned_or_unassigned_pull_request_body(helper: Helper) -> str:
title=pull_request["title"].tame(check_string) if include_title else None,
)
if assignee:
return f"{base_message[:-1]} to {stringified_assignee}."
return base_message.replace("assigned", f"assigned {stringified_assignee} to", 1)
return base_message