From 62ab67fe180e22fd4597c9c740d903228bdb6256 Mon Sep 17 00:00:00 2001 From: Kyle Van Berendonck Date: Sun, 5 Dec 2021 23:34:34 +1100 Subject: [PATCH] [#51]: whPullReqTargetRepo can be null (#52) --- AUTHORS | 1 + CHANGELOG.md | 3 +- ...request-delete-null-head-repo-anomaly.json | 405 ++++++++++++++++++ github-webhooks.cabal | 24 +- package.yaml | 1 + spec/DecodeEventsSpec.hs | 339 ++++++++++++++- src/GitHub/Data/Webhooks/Payload.hs | 2 +- 7 files changed, 753 insertions(+), 22 deletions(-) create mode 100644 fixtures/pull-request-delete-null-head-repo-anomaly.json diff --git a/AUTHORS b/AUTHORS index 1fb6c2b..f01d7cd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Domen Kozar Alistair Burrowes Matthew Bauer Julien Debon +Robert Hensing diff --git a/CHANGELOG.md b/CHANGELOG.md index aef5d49..43e1447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # 0.16.0 * The invitation and membership fields were made optional for `OrganizationEvent` (resolves #37) -* The maintaining sponsor [onrock.online](https://onrock.online) has rebranded to [Cuedo Business Solutions](https://cuedo.com.au) +* The target repository field was made optional for `PullRequestTarget` (by Robert Hensing, resolves #51) * Support for marketplace purchase event (by Alistair Burrowes, resolves #46) +* The maintaining sponsor [onrock.online](https://onrock.online) has rebranded to [Cuedo Business Solutions](https://cuedo.com.au) # 0.15.0 diff --git a/fixtures/pull-request-delete-null-head-repo-anomaly.json b/fixtures/pull-request-delete-null-head-repo-anomaly.json new file mode 100644 index 0000000..1e12d49 --- /dev/null +++ b/fixtures/pull-request-delete-null-head-repo-anomaly.json @@ -0,0 +1,405 @@ +{ + "action": "closed", + "number": 254, + "pull_request": { + "url": "https://api.github.com/repos/upstreamowner/therepo/pulls/254", + "id": 57285673867, + "node_id": "PR_kwODAywNcw4ukzp6", + "html_url": "https://github.com/upstreamowner/therepo/pull/254", + "diff_url": "https://github.com/upstreamowner/therepo/pull/254.diff", + "patch_url": "https://github.com/upstreamowner/therepo/pull/254.patch", + "issue_url": "https://api.github.com/repos/upstreamowner/therepo/issues/254", + "number": 254, + "state": "closed", + "locked": false, + "title": "This was a PR title", + "user": { + "login": "thecontributor", + "id": 8425382758, + "node_id": "MDV6XQlcQjN1EjNNQ4T3", + "avatar_url": "https://avatars.githubusercontent.com/u/8425382758?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/thecontributor", + "html_url": "https://github.com/thecontributor", + "followers_url": "https://api.github.com/users/thecontributor/followers", + "following_url": "https://api.github.com/users/thecontributor/following{/other_user}", + "gists_url": "https://api.github.com/users/thecontributor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/thecontributor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/thecontributor/subscriptions", + "organizations_url": "https://api.github.com/users/thecontributor/orgs", + "repos_url": "https://api.github.com/users/thecontributor/repos", + "events_url": "https://api.github.com/users/thecontributor/events{/privacy}", + "received_events_url": "https://api.github.com/users/thecontributor/received_events", + "type": "User", + "site_admin": false + }, + "body": null, + "created_at": "2021-11-20T20:00:00Z", + "updated_at": "2021-11-20T20:00:00Z", + "closed_at": "2021-11-20T20:00:00Z", + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/upstreamowner/therepo/pulls/254/commits", + "review_comments_url": "https://api.github.com/repos/upstreamowner/therepo/pulls/254/comments", + "review_comment_url": "https://api.github.com/repos/upstreamowner/therepo/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/upstreamowner/therepo/issues/254/comments", + "statuses_url": "https://api.github.com/repos/upstreamowner/therepo/statuses/b31c9f3501a256e212364c839050736f49e5fa6e", + "head": { + "label": "thecontributor:master", + "ref": "master", + "sha": "b319cf3510a25e621236c483950073f6495ef6ae", + "user": { + "login": "thecontributor", + "id": 8425382758, + "node_id": "MDQ6VXNlcjQ1NjE4NTQ3", + "avatar_url": "https://avatars.githubusercontent.com/u/8425382758?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/thecontributor", + "html_url": "https://github.com/thecontributor", + "followers_url": "https://api.github.com/users/thecontributor/followers", + "following_url": "https://api.github.com/users/thecontributor/following{/other_user}", + "gists_url": "https://api.github.com/users/thecontributor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/thecontributor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/thecontributor/subscriptions", + "organizations_url": "https://api.github.com/users/thecontributor/orgs", + "repos_url": "https://api.github.com/users/thecontributor/repos", + "events_url": "https://api.github.com/users/thecontributor/events{/privacy}", + "received_events_url": "https://api.github.com/users/thecontributor/received_events", + "type": "User", + "site_admin": false + }, + "repo": null + }, + "base": { + "label": "upstreamowner:master", + "ref": "master", + "sha": "a42211bde42a98b41bc673f4e90f7b01b41fde5a", + "user": { + "login": "upstreamowner", + "id": 23804562983764, + "node_id": "MDEykO9yZF2auXpdhGvlbjEM2kT3TOQ3", + "avatar_url": "https://avatars.githubusercontent.com/u/23804562983764?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/upstreamowner", + "html_url": "https://github.com/upstreamowner", + "followers_url": "https://api.github.com/users/upstreamowner/followers", + "following_url": "https://api.github.com/users/upstreamowner/following{/other_user}", + "gists_url": "https://api.github.com/users/upstreamowner/gists{/gist_id}", + "starred_url": "https://api.github.com/users/upstreamowner/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/upstreamowner/subscriptions", + "organizations_url": "https://api.github.com/users/upstreamowner/orgs", + "repos_url": "https://api.github.com/users/upstreamowner/repos", + "events_url": "https://api.github.com/users/upstreamowner/events{/privacy}", + "received_events_url": "https://api.github.com/users/upstreamowner/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 53218753, + "node_id": "MDEwOlJlcG9zaXRvcnk1MzIxODc1Mw==", + "name": "therepo", + "full_name": "upstreamowner/therepo", + "private": false, + "owner": { + "login": "upstreamowner", + "id": 23804562983764, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2MTk3OTQ3", + "avatar_url": "https://avatars.githubusercontent.com/u/23804562983764?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/upstreamowner", + "html_url": "https://github.com/upstreamowner", + "followers_url": "https://api.github.com/users/upstreamowner/followers", + "following_url": "https://api.github.com/users/upstreamowner/following{/other_user}", + "gists_url": "https://api.github.com/users/upstreamowner/gists{/gist_id}", + "starred_url": "https://api.github.com/users/upstreamowner/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/upstreamowner/subscriptions", + "organizations_url": "https://api.github.com/users/upstreamowner/orgs", + "repos_url": "https://api.github.com/users/upstreamowner/repos", + "events_url": "https://api.github.com/users/upstreamowner/events{/privacy}", + "received_events_url": "https://api.github.com/users/upstreamowner/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/upstreamowner/therepo", + "description": "Build scripts for the server", + "fork": false, + "url": "https://api.github.com/repos/upstreamowner/therepo", + "forks_url": "https://api.github.com/repos/upstreamowner/therepo/forks", + "keys_url": "https://api.github.com/repos/upstreamowner/therepo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/upstreamowner/therepo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/upstreamowner/therepo/teams", + "hooks_url": "https://api.github.com/repos/upstreamowner/therepo/hooks", + "issue_events_url": "https://api.github.com/repos/upstreamowner/therepo/issues/events{/number}", + "events_url": "https://api.github.com/repos/upstreamowner/therepo/events", + "assignees_url": "https://api.github.com/repos/upstreamowner/therepo/assignees{/user}", + "branches_url": "https://api.github.com/repos/upstreamowner/therepo/branches{/branch}", + "tags_url": "https://api.github.com/repos/upstreamowner/therepo/tags", + "blobs_url": "https://api.github.com/repos/upstreamowner/therepo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/upstreamowner/therepo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/upstreamowner/therepo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/upstreamowner/therepo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/upstreamowner/therepo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/upstreamowner/therepo/languages", + "stargazers_url": "https://api.github.com/repos/upstreamowner/therepo/stargazers", + "contributors_url": "https://api.github.com/repos/upstreamowner/therepo/contributors", + "subscribers_url": "https://api.github.com/repos/upstreamowner/therepo/subscribers", + "subscription_url": "https://api.github.com/repos/upstreamowner/therepo/subscription", + "commits_url": "https://api.github.com/repos/upstreamowner/therepo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/upstreamowner/therepo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/upstreamowner/therepo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/upstreamowner/therepo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/upstreamowner/therepo/contents/{+path}", + "compare_url": "https://api.github.com/repos/upstreamowner/therepo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/upstreamowner/therepo/merges", + "archive_url": "https://api.github.com/repos/upstreamowner/therepo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/upstreamowner/therepo/downloads", + "issues_url": "https://api.github.com/repos/upstreamowner/therepo/issues{/number}", + "pulls_url": "https://api.github.com/repos/upstreamowner/therepo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/upstreamowner/therepo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/upstreamowner/therepo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/upstreamowner/therepo/labels{/name}", + "releases_url": "https://api.github.com/repos/upstreamowner/therepo/releases{/id}", + "deployments_url": "https://api.github.com/repos/upstreamowner/therepo/deployments", + "created_at": "2016-01-01T00:00:00Z", + "updated_at": "2021-11-13T22:00:00Z", + "pushed_at": "2021-11-20T20:00:00Z", + "git_url": "git://github.com/upstreamowner/therepo.git", + "ssh_url": "git@github.com:upstreamowner/therepo.git", + "clone_url": "https://github.com/upstreamowner/therepo.git", + "svn_url": "https://github.com/upstreamowner/therepo", + "homepage": "", + "size": 429518, + "stargazers_count": 8, + "watchers_count": 8, + "language": "SomeLanguage", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 17, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "topics": [ + "mods", + "nix" + ], + "visibility": "public", + "forks": 17, + "open_issues": 3, + "watchers": 8, + "default_branch": "master", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/upstreamowner/therepo/pulls/254" + }, + "html": { + "href": "https://github.com/upstreamowner/therepo/pull/254" + }, + "issue": { + "href": "https://api.github.com/repos/upstreamowner/therepo/issues/254" + }, + "comments": { + "href": "https://api.github.com/repos/upstreamowner/therepo/issues/254/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/upstreamowner/therepo/pulls/254/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/upstreamowner/therepo/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/upstreamowner/therepo/pulls/254/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/upstreamowner/therepo/statuses/b31c9f3501a256e212364c839050736f49e5fa6e" + } + }, + "author_association": "CONTRIBUTOR", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": false, + "rebaseable": false, + "mergeable_state": "dirty", + "merged_by": null, + "comments": 2, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 4, + "additions": 21424, + "deletions": 0, + "changed_files": 1605 + }, + "repository": { + "id": 53218753, + "node_id": "MDEwOlJlcG9zaXRvcnk1MzIxODc1Mw==", + "name": "therepo", + "full_name": "upstreamowner/therepo", + "private": false, + "owner": { + "login": "upstreamowner", + "id": 23804562983764, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2MTk3OTQ3", + "avatar_url": "https://avatars.githubusercontent.com/u/23804562983764?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/upstreamowner", + "html_url": "https://github.com/upstreamowner", + "followers_url": "https://api.github.com/users/upstreamowner/followers", + "following_url": "https://api.github.com/users/upstreamowner/following{/other_user}", + "gists_url": "https://api.github.com/users/upstreamowner/gists{/gist_id}", + "starred_url": "https://api.github.com/users/upstreamowner/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/upstreamowner/subscriptions", + "organizations_url": "https://api.github.com/users/upstreamowner/orgs", + "repos_url": "https://api.github.com/users/upstreamowner/repos", + "events_url": "https://api.github.com/users/upstreamowner/events{/privacy}", + "received_events_url": "https://api.github.com/users/upstreamowner/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/upstreamowner/therepo", + "description": "Build scripts for the server", + "fork": false, + "url": "https://api.github.com/repos/upstreamowner/therepo", + "forks_url": "https://api.github.com/repos/upstreamowner/therepo/forks", + "keys_url": "https://api.github.com/repos/upstreamowner/therepo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/upstreamowner/therepo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/upstreamowner/therepo/teams", + "hooks_url": "https://api.github.com/repos/upstreamowner/therepo/hooks", + "issue_events_url": "https://api.github.com/repos/upstreamowner/therepo/issues/events{/number}", + "events_url": "https://api.github.com/repos/upstreamowner/therepo/events", + "assignees_url": "https://api.github.com/repos/upstreamowner/therepo/assignees{/user}", + "branches_url": "https://api.github.com/repos/upstreamowner/therepo/branches{/branch}", + "tags_url": "https://api.github.com/repos/upstreamowner/therepo/tags", + "blobs_url": "https://api.github.com/repos/upstreamowner/therepo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/upstreamowner/therepo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/upstreamowner/therepo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/upstreamowner/therepo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/upstreamowner/therepo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/upstreamowner/therepo/languages", + "stargazers_url": "https://api.github.com/repos/upstreamowner/therepo/stargazers", + "contributors_url": "https://api.github.com/repos/upstreamowner/therepo/contributors", + "subscribers_url": "https://api.github.com/repos/upstreamowner/therepo/subscribers", + "subscription_url": "https://api.github.com/repos/upstreamowner/therepo/subscription", + "commits_url": "https://api.github.com/repos/upstreamowner/therepo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/upstreamowner/therepo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/upstreamowner/therepo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/upstreamowner/therepo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/upstreamowner/therepo/contents/{+path}", + "compare_url": "https://api.github.com/repos/upstreamowner/therepo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/upstreamowner/therepo/merges", + "archive_url": "https://api.github.com/repos/upstreamowner/therepo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/upstreamowner/therepo/downloads", + "issues_url": "https://api.github.com/repos/upstreamowner/therepo/issues{/number}", + "pulls_url": "https://api.github.com/repos/upstreamowner/therepo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/upstreamowner/therepo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/upstreamowner/therepo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/upstreamowner/therepo/labels{/name}", + "releases_url": "https://api.github.com/repos/upstreamowner/therepo/releases{/id}", + "deployments_url": "https://api.github.com/repos/upstreamowner/therepo/deployments", + "created_at": "2016-01-01T00:00:00Z", + "updated_at": "2021-11-13T22:00:00Z", + "pushed_at": "2021-11-20T20:00:00Z", + "git_url": "git://github.com/upstreamowner/therepo.git", + "ssh_url": "git@github.com:upstreamowner/therepo.git", + "clone_url": "https://github.com/upstreamowner/therepo.git", + "svn_url": "https://github.com/upstreamowner/therepo", + "homepage": "", + "size": 429518, + "stargazers_count": 8, + "watchers_count": 8, + "language": "SomeLanguage", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 17, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "topics": [ + "mods", + "nix" + ], + "visibility": "public", + "forks": 17, + "open_issues": 3, + "watchers": 8, + "default_branch": "master" + }, + "organization": { + "login": "upstreamowner", + "id": 23804562983764, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE2MTk3OTQ3", + "url": "https://api.github.com/orgs/upstreamowner", + "repos_url": "https://api.github.com/orgs/upstreamowner/repos", + "events_url": "https://api.github.com/orgs/upstreamowner/events", + "hooks_url": "https://api.github.com/orgs/upstreamowner/hooks", + "issues_url": "https://api.github.com/orgs/upstreamowner/issues", + "members_url": "https://api.github.com/orgs/upstreamowner/members{/member}", + "public_members_url": "https://api.github.com/orgs/upstreamowner/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/23804562983764?v=4", + "description": null + }, + "sender": { + "login": "thesender", + "id": 3290456203984, + "node_id": "MDQV6XlNcjwIzNkMzjQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/3290456203984?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/thesender", + "html_url": "https://github.com/thesender", + "followers_url": "https://api.github.com/users/thesender/followers", + "following_url": "https://api.github.com/users/thesender/following{/other_user}", + "gists_url": "https://api.github.com/users/thesender/gists{/gist_id}", + "starred_url": "https://api.github.com/users/thesender/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/thesender/subscriptions", + "organizations_url": "https://api.github.com/users/thesender/orgs", + "repos_url": "https://api.github.com/users/thesender/repos", + "events_url": "https://api.github.com/users/thesender/events{/privacy}", + "received_events_url": "https://api.github.com/users/thesender/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 6678514558, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNjY3ODU1OA==" + } +} diff --git a/github-webhooks.cabal b/github-webhooks.cabal index a8c0a21..fd22956 100644 --- a/github-webhooks.cabal +++ b/github-webhooks.cabal @@ -3,8 +3,6 @@ cabal-version: 1.12 -- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack --- --- hash: aa1082b50f20ff4d2ed5d10d0f215c3fa9be961cd238536a50df29ee96172bb1 name: github-webhooks version: 0.15.0 @@ -20,7 +18,8 @@ author: Kyle Van Berendonck , Domen Kozar , Alistair Burrowes, Matthew Bauer, - Julien Debon + Julien Debon, + Robert Hensing maintainer: Kyle Van Berendonck copyright: (c) 2017-2020 Cuedo Business Solutions license: MIT @@ -65,6 +64,7 @@ extra-source-files: fixtures/project-column-event.json fixtures/project-event.json fixtures/public-event.json + fixtures/pull-request-delete-null-head-repo-anomaly.json fixtures/pull-request-event-null-body.json fixtures/pull-request-event.json fixtures/pull-request-review-comment-event.json @@ -87,6 +87,12 @@ flag ci default: False library + exposed-modules: + GitHub.Data.Webhooks.Events + GitHub.Data.Webhooks.Payload + GitHub.Data.Webhooks.Secure + other-modules: + Paths_github_webhooks hs-source-dirs: src default-extensions: @@ -107,17 +113,14 @@ library , vector if flag(ci) ghc-options: -Wall -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi - exposed-modules: - GitHub.Data.Webhooks.Events - GitHub.Data.Webhooks.Payload - GitHub.Data.Webhooks.Secure - other-modules: - Paths_github_webhooks default-language: Haskell2010 test-suite spec type: exitcode-stdio-1.0 main-is: Spec.hs + other-modules: + DecodeEventsSpec + Paths_github_webhooks hs-source-dirs: spec default-extensions: @@ -135,7 +138,4 @@ test-suite spec , vector if flag(ci) ghc-options: -Wall -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -ddump-to-file -ddump-hi - other-modules: - DecodeEventsSpec - Paths_github_webhooks default-language: Haskell2010 diff --git a/package.yaml b/package.yaml index 26fd202..3451ad3 100644 --- a/package.yaml +++ b/package.yaml @@ -20,6 +20,7 @@ author: - Alistair Burrowes - Matthew Bauer - Julien Debon + - Robert Hensing maintainer: Kyle Van Berendonck github: onrock-eng/github-webhooks description: diff --git a/spec/DecodeEventsSpec.hs b/spec/DecodeEventsSpec.hs index 53fdf7b..12bb2a0 100644 --- a/spec/DecodeEventsSpec.hs +++ b/spec/DecodeEventsSpec.hs @@ -66,6 +66,7 @@ spec = do it "can decode PublicEvent" $ fixtureShouldMatch "fixtures/public-event.json" publicEventFixture it "can decode PullRequestEvent" $ fixtureShouldMatch "fixtures/pull-request-event.json" pullRequestEventFixture it "can decode PullRequestEvent when body is null" $ fixtureShouldMatch "fixtures/pull-request-event-null-body.json" pullRequestEventNullBodyFixture + it "can decode PullRequestEvent when head.repo is null" $ fixtureShouldMatch "fixtures/pull-request-delete-null-head-repo-anomaly.json" pullRequestEventDeleteNullHeadRepoAnomalyFixture it "can decode PullRequestReviewCommentEvent" $ fixtureShouldMatch "fixtures/pull-request-review-comment-event.json" pullRequestReviewCommentEventFixture it "can decode PullRequestReviewEvent" $ fixtureShouldMatch "fixtures/pull-request-review-event.json" pullRequestReviewEventFixture it "can decode PushEvent" $ fixtureShouldMatch "fixtures/push-event.json" pushEventFixture @@ -3576,7 +3577,7 @@ pullRequestEventFixture = PullRequestEvent , whUserIsAdminOfSite = False } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 35129377 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" @@ -3692,7 +3693,7 @@ pullRequestEventFixture = PullRequestEvent , whUserIsAdminOfSite = False } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 35129377 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" @@ -3979,7 +3980,7 @@ pullRequestEventNullBodyFixture = PullRequestEvent , whUserIsAdminOfSite = False } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 35129377 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" @@ -4095,7 +4096,7 @@ pullRequestEventNullBodyFixture = PullRequestEvent , whUserIsAdminOfSite = False } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 35129377 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" @@ -4306,6 +4307,328 @@ pullRequestEventNullBodyFixture = PullRequestEvent , evPullReqInstallationId = Just 234 } +pullRequestEventDeleteNullHeadRepoAnomalyFixture :: PullRequestEvent +pullRequestEventDeleteNullHeadRepoAnomalyFixture = + PullRequestEvent + { evPullReqAction = PullRequestClosedAction, + evPullReqNumber = 254, + evPullReqPayload = + HookPullRequest + { whPullReqUrl = URL "https://api.github.com/repos/upstreamowner/therepo/pulls/254", + whPullReqId = 57285673867, + whPullReqNodeId = "PR_kwODAywNcw4ukzp6", + whPullReqHtmlUrl = URL "https://github.com/upstreamowner/therepo/pull/254", + whPullReqDiffUrl = URL "https://github.com/upstreamowner/therepo/pull/254.diff", + whPullReqPatchUrl = URL "https://github.com/upstreamowner/therepo/pull/254.patch", + whPullReqIssueUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues/254", + whPullReqNumber = 254, + whPullReqState = "closed", + whPullReqIsLocked = False, + whPullReqTitle = "This was a PR title", + whPullReqUser = + HookUser + { whUserLogin = "thecontributor", + whUserId = 8425382758, + whUserNodeId = "MDV6XQlcQjN1EjNNQ4T3", + whUserAvatarUrl = URL "https://avatars.githubusercontent.com/u/8425382758?v=4", + whUserGravatarId = URL "", + whUserUrl = URL "https://api.github.com/users/thecontributor", + whUserHtmlUrl = URL "https://github.com/thecontributor", + whUserFollowersUrl = URL "https://api.github.com/users/thecontributor/followers", + whUserFollowingUrl = URL "https://api.github.com/users/thecontributor/following{/other_user}", + whUserGistsUrl = URL "https://api.github.com/users/thecontributor/gists{/gist_id}", + whUserStarredUrl = URL "https://api.github.com/users/thecontributor/starred{/owner}{/repo}", + whUserSubscriptionsUrl = URL "https://api.github.com/users/thecontributor/subscriptions", + whUserOrganizationsUrl = URL "https://api.github.com/users/thecontributor/orgs", + whUserReposUrl = URL "https://api.github.com/users/thecontributor/repos", + whUserEventsUrl = URL "https://api.github.com/users/thecontributor/events{/privacy}", + whUserReceivedEventsUrl = URL "https://api.github.com/users/thecontributor/received_events", + whUserType = OwnerUser, + whUserIsAdminOfSite = False + }, + whPullReqBody = "", + whPullReqCreatedAt = read "2021-11-20 20:00:00Z", + whPullReqUpdatedAt = read "2021-11-20 20:00:00Z", + whPullReqClosedAt = Just $ read "2021-11-20 20:00:00Z", + whPullReqMergedAt = Nothing, + whPullReqMergeCommitSha = Nothing, + whPullReqAssignee = Nothing, + whPullReqMilestone = Nothing, + whPullReqCommitsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/pulls/254/commits", + whPullReqRevCommentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/pulls/254/comments", + whPullReqRevCommentUrl = URL "https://api.github.com/repos/upstreamowner/therepo/pulls/comments{/number}", + whPullReqCommentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues/254/comments", + whPullReqStatusesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/statuses/b31c9f3501a256e212364c839050736f49e5fa6e", + whPullReqBase = + PullRequestTarget + { whPullReqTargetSha = "a42211bde42a98b41bc673f4e90f7b01b41fde5a", + whPullReqTargetUser = + HookUser + { whUserLogin = "upstreamowner", + whUserId = 23804562983764, + whUserNodeId = "MDEykO9yZF2auXpdhGvlbjEM2kT3TOQ3", + whUserAvatarUrl = URL "https://avatars.githubusercontent.com/u/23804562983764?v=4", + whUserGravatarId = URL "", + whUserUrl = URL "https://api.github.com/users/upstreamowner", + whUserHtmlUrl = URL "https://github.com/upstreamowner", + whUserFollowersUrl = URL "https://api.github.com/users/upstreamowner/followers", + whUserFollowingUrl = URL "https://api.github.com/users/upstreamowner/following{/other_user}", + whUserGistsUrl = URL "https://api.github.com/users/upstreamowner/gists{/gist_id}", + whUserStarredUrl = URL "https://api.github.com/users/upstreamowner/starred{/owner}{/repo}", + whUserSubscriptionsUrl = URL "https://api.github.com/users/upstreamowner/subscriptions", + whUserOrganizationsUrl = URL "https://api.github.com/users/upstreamowner/orgs", + whUserReposUrl = URL "https://api.github.com/users/upstreamowner/repos", + whUserEventsUrl = URL "https://api.github.com/users/upstreamowner/events{/privacy}", + whUserReceivedEventsUrl = URL "https://api.github.com/users/upstreamowner/received_events", + whUserType = OwnerOrganization, + whUserIsAdminOfSite = False + }, + whPullReqTargetRepo = + Just + ( HookRepository + { whRepoId = 53218753, + whRepoNodeId = "MDEwOlJlcG9zaXRvcnk1MzIxODc1Mw==", + whRepoName = "therepo", + whRepoFullName = "upstreamowner/therepo", + whRepoOwner = + Right + ( HookUser + { whUserLogin = "upstreamowner", + whUserId = 23804562983764, + whUserNodeId = "MDEyOk9yZ2FuaXphdGlvbjE2MTk3OTQ3", + whUserAvatarUrl = URL "https://avatars.githubusercontent.com/u/23804562983764?v=4", + whUserGravatarId = URL "", + whUserUrl = URL "https://api.github.com/users/upstreamowner", + whUserHtmlUrl = URL "https://github.com/upstreamowner", + whUserFollowersUrl = URL "https://api.github.com/users/upstreamowner/followers", + whUserFollowingUrl = URL "https://api.github.com/users/upstreamowner/following{/other_user}", + whUserGistsUrl = URL "https://api.github.com/users/upstreamowner/gists{/gist_id}", + whUserStarredUrl = URL "https://api.github.com/users/upstreamowner/starred{/owner}{/repo}", + whUserSubscriptionsUrl = URL "https://api.github.com/users/upstreamowner/subscriptions", + whUserOrganizationsUrl = URL "https://api.github.com/users/upstreamowner/orgs", + whUserReposUrl = URL "https://api.github.com/users/upstreamowner/repos", + whUserEventsUrl = URL "https://api.github.com/users/upstreamowner/events{/privacy}", + whUserReceivedEventsUrl = URL "https://api.github.com/users/upstreamowner/received_events", + whUserType = OwnerOrganization, + whUserIsAdminOfSite = False + } + ), + whRepoIsPrivate = False, + whRepoHtmlUrl = URL "https://github.com/upstreamowner/therepo", + whRepoDescription = "Build scripts for the server", + whRepoIsAFork = False, + whRepoUrl = URL "https://api.github.com/repos/upstreamowner/therepo", + whRepoForksUrl = URL "https://api.github.com/repos/upstreamowner/therepo/forks", + whRepoKeysUrl = URL "https://api.github.com/repos/upstreamowner/therepo/keys{/key_id}", + whRepoCollaboratorsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/collaborators{/collaborator}", + whRepoTeamsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/teams", + whRepoHooksUrl = URL "https://api.github.com/repos/upstreamowner/therepo/hooks", + whRepoIssueEventsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues/events{/number}", + whRepoEventsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/events", + whRepoAssigneesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/assignees{/user}", + whRepoBranchesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/branches{/branch}", + whRepoTagsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/tags", + whRepoBlobsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/blobs{/sha}", + whRepoGitTagsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/tags{/sha}", + whRepoGitRefsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/refs{/sha}", + whRepoTreesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/trees{/sha}", + whRepoStatusesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/statuses/{sha}", + whRepoLanguagesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/languages", + whRepoStargazersUrl = URL "https://api.github.com/repos/upstreamowner/therepo/stargazers", + whRepoContributorsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/contributors", + whRepoSubscribersUrl = URL "https://api.github.com/repos/upstreamowner/therepo/subscribers", + whRepoSubscriptionUrl = URL "https://api.github.com/repos/upstreamowner/therepo/subscription", + whRepoCommitsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/commits{/sha}", + whRepoGitCommitsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/commits{/sha}", + whRepoCommentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/comments{/number}", + whRepoIssueCommentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues/comments{/number}", + whRepoContentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/contents/{+path}", + whRepoCompareUrl = URL "https://api.github.com/repos/upstreamowner/therepo/compare/{base}...{head}", + whRepoMergesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/merges", + whRepoArchiveUrl = URL "https://api.github.com/repos/upstreamowner/therepo/{archive_format}{/ref}", + whRepoDownloadsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/downloads", + whRepoIssuesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues{/number}", + whRepoPullsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/pulls{/number}", + whRepoMilestonesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/milestones{/number}", + whRepoNotificationsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/notifications{?since,all,participating}", + whRepoLabelsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/labels{/name}", + whRepoReleasesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/releases{/id}", + whRepoCreatedAt = read "2016-01-01 00:00:00Z", + whRepoUpdatedAt = read "2021-11-13 22:00:00Z", + whRepoPushedAt = read "2021-11-20 20:00:00Z", + whRepoGitUrl = URL "git://github.com/upstreamowner/therepo.git", + whRepoSshUrl = URL "git@github.com:upstreamowner/therepo.git", + whRepoCloneUrl = URL "https://github.com/upstreamowner/therepo.git", + whRepoSvnUrl = URL "https://github.com/upstreamowner/therepo", + whRepoHomepage = Just (URL ""), + whRepoSize = 429518, + whRepoStargazersCount = 8, + whRepoWatchersCount = 8, + whRepoLanguage = Just "SomeLanguage", + whRepoHasIssues = True, + whRepoHasDownloads = True, + whRepoHasWiki = True, + whRepoHasPages = False, + whRepoForkCount = 17, + whRepoMirrorUrl = Nothing, + whRepoOpenIssuesCount = 3, + whRepoDefaultBranchName = "master" + } + ), + whPullReqTargetLabel = "upstreamowner:master", + whPullReqTargetRef = "master" + }, + whPullReqHead = + PullRequestTarget + { whPullReqTargetSha = "b319cf3510a25e621236c483950073f6495ef6ae", + whPullReqTargetUser = + HookUser + { whUserLogin = "thecontributor", + whUserId = 8425382758, + whUserNodeId = "MDQ6VXNlcjQ1NjE4NTQ3", + whUserAvatarUrl = URL "https://avatars.githubusercontent.com/u/8425382758?v=4", + whUserGravatarId = URL "", + whUserUrl = URL "https://api.github.com/users/thecontributor", + whUserHtmlUrl = URL "https://github.com/thecontributor", + whUserFollowersUrl = URL "https://api.github.com/users/thecontributor/followers", + whUserFollowingUrl = URL "https://api.github.com/users/thecontributor/following{/other_user}", + whUserGistsUrl = URL "https://api.github.com/users/thecontributor/gists{/gist_id}", + whUserStarredUrl = URL "https://api.github.com/users/thecontributor/starred{/owner}{/repo}", + whUserSubscriptionsUrl = URL "https://api.github.com/users/thecontributor/subscriptions", + whUserOrganizationsUrl = URL "https://api.github.com/users/thecontributor/orgs", + whUserReposUrl = URL "https://api.github.com/users/thecontributor/repos", + whUserEventsUrl = URL "https://api.github.com/users/thecontributor/events{/privacy}", + whUserReceivedEventsUrl = URL "https://api.github.com/users/thecontributor/received_events", + whUserType = OwnerUser, + whUserIsAdminOfSite = False + }, + whPullReqTargetRepo = Nothing, + whPullReqTargetLabel = "thecontributor:master", + whPullReqTargetRef = "master" + }, + whPullReqMergeableState = Just "dirty", + whPullReqCommentCount = Just 2, + whPullReqRevCommentCount = Just 0, + whPullReqCommitCount = Just 4, + whPullReqAdditionsCount = Just 21424, + whPullReqDeletionsCount = Just 0, + whPullReqFileChangeCount = Just 1605 + }, + evPullReqRepo = + HookRepository + { whRepoId = 53218753, + whRepoNodeId = "MDEwOlJlcG9zaXRvcnk1MzIxODc1Mw==", + whRepoName = "therepo", + whRepoFullName = "upstreamowner/therepo", + whRepoOwner = + Right + ( HookUser + { whUserLogin = "upstreamowner", + whUserId = 23804562983764, + whUserNodeId = "MDEyOk9yZ2FuaXphdGlvbjE2MTk3OTQ3", + whUserAvatarUrl = URL "https://avatars.githubusercontent.com/u/23804562983764?v=4", + whUserGravatarId = URL "", + whUserUrl = URL "https://api.github.com/users/upstreamowner", + whUserHtmlUrl = URL "https://github.com/upstreamowner", + whUserFollowersUrl = URL "https://api.github.com/users/upstreamowner/followers", + whUserFollowingUrl = URL "https://api.github.com/users/upstreamowner/following{/other_user}", + whUserGistsUrl = URL "https://api.github.com/users/upstreamowner/gists{/gist_id}", + whUserStarredUrl = URL "https://api.github.com/users/upstreamowner/starred{/owner}{/repo}", + whUserSubscriptionsUrl = URL "https://api.github.com/users/upstreamowner/subscriptions", + whUserOrganizationsUrl = URL "https://api.github.com/users/upstreamowner/orgs", + whUserReposUrl = URL "https://api.github.com/users/upstreamowner/repos", + whUserEventsUrl = URL "https://api.github.com/users/upstreamowner/events{/privacy}", + whUserReceivedEventsUrl = URL "https://api.github.com/users/upstreamowner/received_events", + whUserType = OwnerOrganization, + whUserIsAdminOfSite = False + } + ), + whRepoIsPrivate = False, + whRepoHtmlUrl = URL "https://github.com/upstreamowner/therepo", + whRepoDescription = "Build scripts for the server", + whRepoIsAFork = False, + whRepoUrl = URL "https://api.github.com/repos/upstreamowner/therepo", + whRepoForksUrl = URL "https://api.github.com/repos/upstreamowner/therepo/forks", + whRepoKeysUrl = URL "https://api.github.com/repos/upstreamowner/therepo/keys{/key_id}", + whRepoCollaboratorsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/collaborators{/collaborator}", + whRepoTeamsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/teams", + whRepoHooksUrl = URL "https://api.github.com/repos/upstreamowner/therepo/hooks", + whRepoIssueEventsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues/events{/number}", + whRepoEventsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/events", + whRepoAssigneesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/assignees{/user}", + whRepoBranchesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/branches{/branch}", + whRepoTagsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/tags", + whRepoBlobsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/blobs{/sha}", + whRepoGitTagsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/tags{/sha}", + whRepoGitRefsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/refs{/sha}", + whRepoTreesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/trees{/sha}", + whRepoStatusesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/statuses/{sha}", + whRepoLanguagesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/languages", + whRepoStargazersUrl = URL "https://api.github.com/repos/upstreamowner/therepo/stargazers", + whRepoContributorsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/contributors", + whRepoSubscribersUrl = URL "https://api.github.com/repos/upstreamowner/therepo/subscribers", + whRepoSubscriptionUrl = URL "https://api.github.com/repos/upstreamowner/therepo/subscription", + whRepoCommitsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/commits{/sha}", + whRepoGitCommitsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/git/commits{/sha}", + whRepoCommentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/comments{/number}", + whRepoIssueCommentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues/comments{/number}", + whRepoContentsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/contents/{+path}", + whRepoCompareUrl = URL "https://api.github.com/repos/upstreamowner/therepo/compare/{base}...{head}", + whRepoMergesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/merges", + whRepoArchiveUrl = URL "https://api.github.com/repos/upstreamowner/therepo/{archive_format}{/ref}", + whRepoDownloadsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/downloads", + whRepoIssuesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/issues{/number}", + whRepoPullsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/pulls{/number}", + whRepoMilestonesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/milestones{/number}", + whRepoNotificationsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/notifications{?since,all,participating}", + whRepoLabelsUrl = URL "https://api.github.com/repos/upstreamowner/therepo/labels{/name}", + whRepoReleasesUrl = URL "https://api.github.com/repos/upstreamowner/therepo/releases{/id}", + whRepoCreatedAt = read "2016-01-01 00:00:00Z", + whRepoUpdatedAt = read "2021-11-13 22:00:00Z", + whRepoPushedAt = read "2021-11-20 20:00:00Z", + whRepoGitUrl = URL "git://github.com/upstreamowner/therepo.git", + whRepoSshUrl = URL "git@github.com:upstreamowner/therepo.git", + whRepoCloneUrl = URL "https://github.com/upstreamowner/therepo.git", + whRepoSvnUrl = URL "https://github.com/upstreamowner/therepo", + whRepoHomepage = Just (URL ""), + whRepoSize = 429518, + whRepoStargazersCount = 8, + whRepoWatchersCount = 8, + whRepoLanguage = Just "SomeLanguage", + whRepoHasIssues = True, + whRepoHasDownloads = True, + whRepoHasWiki = True, + whRepoHasPages = False, + whRepoForkCount = 17, + whRepoMirrorUrl = Nothing, + whRepoOpenIssuesCount = 3, + whRepoDefaultBranchName = "master" + }, + evPullReqSender = + HookUser + { whUserLogin = "thesender", + whUserId = 3290456203984, + whUserNodeId = "MDQV6XlNcjwIzNkMzjQ=", + whUserAvatarUrl = URL "https://avatars.githubusercontent.com/u/3290456203984?v=4", + whUserGravatarId = URL "", + whUserUrl = URL "https://api.github.com/users/thesender", + whUserHtmlUrl = URL "https://github.com/thesender", + whUserFollowersUrl = URL "https://api.github.com/users/thesender/followers", + whUserFollowingUrl = URL "https://api.github.com/users/thesender/following{/other_user}", + whUserGistsUrl = URL "https://api.github.com/users/thesender/gists{/gist_id}", + whUserStarredUrl = URL "https://api.github.com/users/thesender/starred{/owner}{/repo}", + whUserSubscriptionsUrl = URL "https://api.github.com/users/thesender/subscriptions", + whUserOrganizationsUrl = URL "https://api.github.com/users/thesender/orgs", + whUserReposUrl = URL "https://api.github.com/users/thesender/repos", + whUserEventsUrl = URL "https://api.github.com/users/thesender/events{/privacy}", + whUserReceivedEventsUrl = URL "https://api.github.com/users/thesender/received_events", + whUserType = OwnerUser, + whUserIsAdminOfSite = False + }, + evPullReqInstallationId = Just 6678514558 + } + + pullRequestReviewCommentEventFixture :: PullRequestReviewCommentEvent pullRequestReviewCommentEventFixture = PullRequestReviewCommentEvent { evPullReqRevComAction = PullRequestReviewCommentCreatedAction @@ -4426,7 +4749,7 @@ pullRequestReviewCommentEventFixture = PullRequestReviewCommentEvent , whUserIsAdminOfSite = False } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 35129377 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" @@ -4542,7 +4865,7 @@ pullRequestReviewCommentEventFixture = PullRequestReviewCommentEvent , whUserIsAdminOfSite = False } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 35129377 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" @@ -4853,7 +5176,7 @@ pullRequestReviewEventFixture = PullRequestReviewEvent , whUserIsAdminOfSite = False } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 35129377 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" @@ -4969,7 +5292,7 @@ pullRequestReviewEventFixture = PullRequestReviewEvent , whUserIsAdminOfSite = True } , whPullReqTargetRepo = - HookRepository + Just HookRepository { whRepoId = 69919152 , whRepoNodeId = "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=" , whRepoName = "public-repo" diff --git a/src/GitHub/Data/Webhooks/Payload.hs b/src/GitHub/Data/Webhooks/Payload.hs index 01a73ba..2f36601 100644 --- a/src/GitHub/Data/Webhooks/Payload.hs +++ b/src/GitHub/Data/Webhooks/Payload.hs @@ -854,7 +854,7 @@ instance NFData HookPullRequest where rnf = genericRnf data PullRequestTarget = PullRequestTarget { whPullReqTargetSha :: !Text , whPullReqTargetUser :: !HookUser - , whPullReqTargetRepo :: !HookRepository + , whPullReqTargetRepo :: !(Maybe HookRepository) -- maybe null, see #47 , whPullReqTargetLabel :: !Text -- ex "user:branch" , whPullReqTargetRef :: !Text -- ex "somebranch" }