integrations: Use correct type for GitHub pull request comment messages.

This commit is contained in:
Satyam Bansal
2023-07-12 02:17:36 +05:30
committed by Tim Abbott
parent d2589a5bd1
commit cda7ed7101
2 changed files with 3 additions and 2 deletions

View File

@@ -146,7 +146,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("issue_comment", expected_topic, expected_message) self.check_webhook("issue_comment", expected_topic, expected_message)
def test_issue_comment_pull_request_comment_msg(self) -> None: def test_issue_comment_pull_request_comment_msg(self) -> None:
expected_message = "sbansal1999 [commented](https://github.com/sbansal1999/public-repo/pull/1#issuecomment-1631445420) on [issue #1](https://github.com/sbansal1999/public-repo/pull/1):\n\n~~~ quote\nSome comment\n~~~" expected_message = "sbansal1999 [commented](https://github.com/sbansal1999/public-repo/pull/1#issuecomment-1631445420) on [PR #1](https://github.com/sbansal1999/public-repo/pull/1):\n\n~~~ quote\nSome comment\n~~~"
self.check_webhook("issue_comment__pull_request_comment", TOPIC_PR, expected_message) self.check_webhook("issue_comment__pull_request_comment", TOPIC_PR, expected_message)
def test_issue_msg(self) -> None: def test_issue_msg(self) -> None:

View File

@@ -190,13 +190,14 @@ def get_issue_comment_body(helper: Helper) -> str:
action = f"{action} a [comment]" action = f"{action} a [comment]"
action += "({}) on".format(comment["html_url"].tame(check_string)) action += "({}) on".format(comment["html_url"].tame(check_string))
return get_issue_event_message( return get_pull_request_event_message(
user_name=get_sender_name(payload), user_name=get_sender_name(payload),
action=action, action=action,
url=issue["html_url"].tame(check_string), url=issue["html_url"].tame(check_string),
number=issue["number"].tame(check_int), number=issue["number"].tame(check_int),
message=comment["body"].tame(check_string), message=comment["body"].tame(check_string),
title=issue["title"].tame(check_string) if include_title else None, title=issue["title"].tame(check_string) if include_title else None,
type="PR" if is_pull_request_comment_event(payload) else "issue",
) )