integrations: Prevent duplicate GitHub pull request review messages.

GitHub sends two almost identical payloads when a pull
request is reviewed, which results in two duplicative
notification messages.

The payloads have different "action" value, with one
having the "submitted" action, whereas the other is
"edited" and has an empty "changes" dict.

We now ignore the payload with the "edited" action type
and an empty "changes" dict.

Fixes #26145.

Co-authored-by: Pieter CK <pieterceka123@gmail.com>
This commit is contained in:
lumpleme
2024-05-26 21:38:01 -03:00
committed by Tim Abbott
parent 76df435dab
commit b5c63cfb85
3 changed files with 533 additions and 0 deletions

View File

@@ -479,6 +479,10 @@ A temporary team so that I can get some webhook fixtures!
payload = orjson.dumps(data).decode()
self.verify_post_is_ignored(payload, "pull_request")
def test_pull_request_review_edited_empty_changes_ignore(self) -> None:
payload = self.get_body("pull_request_review__edited_empty_changes")
self.verify_post_is_ignored(payload, "pull_request_review")
def test_ignored_team_actions(self) -> None:
ignored_actions = [
"added_to_repository",