webhooks/github: Suppress "comment edited" events when body is same.

GitHub generates spurious edited events on hiding/unhiding a comment,
and on clicking "edit"/"update" without any changes, when the
comment "body" contains certain specific characters.

Instead of sending a notification message, we suppress those edge cases
by comparing the "body" content of the comment and changes in the event
payload.

Fixes #31042, #26136.
This commit is contained in:
Niloth P
2025-01-03 03:50:33 +05:30
committed by Tim Abbott
parent 1ce1412166
commit 09f47d5a0a
3 changed files with 263 additions and 0 deletions

View File

@@ -629,6 +629,14 @@ A temporary team so that I can get some webhook fixtures!
expected_message = "sbansal1999 edited a [comment](https://github.com/sbansal1999/testing-gh/discussions/20#discussioncomment-6332416) on [discussion #20](https://github.com/sbansal1999/testing-gh/discussions/20):\n\n~~~ quote\nsome random comment edited\n~~~"
self.check_webhook("discussion_comment__edited", TOPIC_DISCUSSION, expected_message)
def test_comment_edited_unchanged_skipped(self) -> None:
self.check_webhook(
fixture_name="issue_comment__edited__unchanged",
expected_topic_name=None,
expected_message=None,
expect_noop=True,
)
class GitHubSponsorsHookTests(WebhookTestCase):
CHANNEL_NAME = "github"