Skip to content

Handle GitHub's ReviewDismissed events and events in dismissed state

Administrator requested to merge a8n/github-dismissed into master

Created by: mrnugget

This fixes #8370 by handling GitHub's support for dismissing reviews.

There are two ways in which the dismissal of a review can show up in our codebase.

  1. As a ReviewDismissed event. This is emitted when a review is dimissed (either by the author of the reviewD itself or by another person)
  2. As the DISMISSED state of a review. When a review is dimissed, the PullRequestReview object embedded in a PullRequestReviewedEvent is updated and its state is changed to DISMISSED.

Here's what these two events look like in our database:

-[ RECORD 5 ]+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
id           | 23022
changeset_id | 12
kind         | github:reviewed
key          | 357299055
created_at   | 2020-02-12 01:51:10.305031-08
metadata     | {"URL": "https://github.com/sourcegraph/automation-testing/pull/156#pullrequestreview-357299055", "Body": "looks good", "State": "DISMISSED", "Author": {"URL": "https://github.com/mrnugget", "Login": "mrnugget", "AvatarURL": "https://avatars3.githubusercontent.com/u/1185253?v=4"}, "Commit": {"OID": "05e562cc5d8ab50b5fcab8dfd5dfa5db13a48e80", "URL": "https://github.com/sourcegraph/automation-testing/commit/05e562cc5d8ab50b5fcab8dfd5dfa5db13a48e80", "Status": {"State": "", "Contexts": null}, "Message": "Add foobar.md file", "Committer": {"Name": "Thorsten Ball", "User": {"URL": "https://github.com/mrnugget", "Login": "mrnugget", "AvatarURL": "https://avatars3.githubusercontent.com/u/1185253?v=4"}, "Email": "[email protected]", "AvatarURL": "https://avatars3.githubusercontent.com/u/1185253?v=4"}, "PushedDate": "2019-11-12T13:00:07Z", "CommittedDate": "2019-11-12T12:57:33Z", "MessageHeadline": "Add foobar.md file"}, "CreatedAt": "2020-02-12T09:28:18Z", "UpdatedAt": "2020-02-12T09:28:33Z", "DatabaseID": 357299055, "AuthorAssociation": "MEMBER", "IncludesCreatedEdit": false}
updated_at   | 2020-02-12 04:22:57.021974-08
-[ RECORD 6 ]+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
id           | 23023
changeset_id | 12
kind         | github:review_dismissed
key          | ryanslade:357299055:1581499713000000000
created_at   | 2020-02-12 01:51:10.305031-08
metadata     | {"Actor": {"URL": "https://github.com/ryanslade", "Login": "ryanslade", "AvatarURL": "https://avatars3.githubusercontent.com/u/25610?v=4"}, "Review": {"URL": "https://github.com/sourcegraph/automation-testing/pull/156#pullrequestreview-357299055", "Body": "looks good", "State": "DISMISSED", "Author": {"URL": "https://github.com/mrnugget", "Login": "mrnugget", "AvatarURL": "https://avatars3.githubusercontent.com/u/1185253?v=4"}, "Commit": {"OID": "05e562cc5d8ab50b5fcab8dfd5dfa5db13a48e80", "URL": "https://github.com/sourcegraph/automation-testing/commit/05e562cc5d8ab50b5fcab8dfd5dfa5db13a48e80", "Status": {"State": "", "Contexts": null}, "Message": "Add foobar.md file", "Committer": {"Name": "Thorsten Ball", "User": {"URL": "https://github.com/mrnugget", "Login": "mrnugget", "AvatarURL": "https://avatars3.githubusercontent.com/u/1185253?v=4"}, "Email": "[email protected]", "AvatarURL": "https://avatars3.githubusercontent.com/u/1185253?v=4"}, "PushedDate": "2019-11-12T13:00:07Z", "CommittedDate": "2019-11-12T12:57:33Z", "MessageHeadline": "Add foobar.md file"}, "CreatedAt": "2020-02-12T09:28:18Z", "UpdatedAt": "2020-02-12T09:28:33Z", "DatabaseID": 357299055, "AuthorAssociation": "MEMBER", "IncludesCreatedEdit": false}, "CreatedAt": "2020-02-12T09:28:33Z", "DismissalMessage": "Things"}
updated_at   | 2020-02-12 04:22:57.021974-08

The code here handles both cases.

Merge request reports

Loading