Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

github webhook: Support all actions on discussion events.

Niloth P14173b757f93
diff --git a/zerver/webhooks/github/fixtures/discussion.json b/zerver/webhooks/github/fixtures/discussion.json
deleted file mode 100644
index e42a714252f..00000000000
--- a/zerver/webhooks/github/fixtures/discussion.json
+++ /dev/null
@@ -1,188 +0,0 @@
-{
- "action": "created",
- "discussion": {
- "repository_url": "https://api.github.com/repos/sbansal1999/testing-gh",
- "category": {
- "id": 39681817,
- "node_id": "DIC_kwDOJRp_V84CXX8Z",
- "repository_id": 622493527,
- "emoji": ":speech_balloon:",
- "name": "General",
- "description": "Chat about anything and everything here",
- "created_at": "2023-06-21T23:02:39.000+05:30",
- "updated_at": "2023-06-21T23:02:39.000+05:30",
- "slug": "general",
- "is_answerable": false
- },
- "answer_html_url": null,
- "answer_chosen_at": null,
- "answer_chosen_by": null,
- "html_url": "https://github.com/sbansal1999/testing-gh/discussions/20",
- "id": 5357975,
- "node_id": "D_kwDOJRp_V84AUcGX",
- "number": 20,
- "title": "Lets discuss",
- "user": {
- "login": "sbansal1999",
- "id": 35286603,
- "node_id": "MDQ6VXNlcjM1Mjg2NjAz",
- "avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
- "gravatar_id": "",
- "url": "https://api.github.com/users/sbansal1999",
- "html_url": "https://github.com/sbansal1999",
- "followers_url": "https://api.github.com/users/sbansal1999/followers",
- "following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
- "gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
- "starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
- "subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
- "organizations_url": "https://api.github.com/users/sbansal1999/orgs",
- "repos_url": "https://api.github.com/users/sbansal1999/repos",
- "events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
- "received_events_url": "https://api.github.com/users/sbansal1999/received_events",
- "type": "User",
- "site_admin": false
- },
- "state": "open",
- "state_reason": null,
- "locked": false,
- "comments": 0,
- "created_at": "2023-07-01T13:21:16Z",
- "updated_at": "2023-07-01T13:21:16Z",
- "author_association": "OWNER",
- "active_lock_reason": null,
- "body": "Some random text about which no one cares.\r\n",
- "reactions": {
- "url": "https://api.github.com/repos/sbansal1999/testing-gh/discussions/20/reactions",
- "total_count": 0,
- "+1": 0,
- "-1": 0,
- "laugh": 0,
- "hooray": 0,
- "confused": 0,
- "heart": 0,
- "rocket": 0,
- "eyes": 0
- },
- "timeline_url": "https://api.github.com/repos/sbansal1999/testing-gh/discussions/20/timeline"
- },
- "repository": {
- "id": 622493527,
- "node_id": "R_kgDOJRp_Vw",
- "name": "testing-gh",
- "full_name": "sbansal1999/testing-gh",
- "private": false,
- "owner": {
- "login": "sbansal1999",
- "id": 35286603,
- "node_id": "MDQ6VXNlcjM1Mjg2NjAz",
- "avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
- "gravatar_id": "",
- "url": "https://api.github.com/users/sbansal1999",
- "html_url": "https://github.com/sbansal1999",
- "followers_url": "https://api.github.com/users/sbansal1999/followers",
- "following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
- "gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
- "starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
- "subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
- "organizations_url": "https://api.github.com/users/sbansal1999/orgs",
- "repos_url": "https://api.github.com/users/sbansal1999/repos",
- "events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
- "received_events_url": "https://api.github.com/users/sbansal1999/received_events",
- "type": "User",
- "site_admin": false
- },
- "html_url": "https://github.com/sbansal1999/testing-gh",
- "description": null,
- "fork": false,
- "url": "https://api.github.com/repos/sbansal1999/testing-gh",
- "forks_url": "https://api.github.com/repos/sbansal1999/testing-gh/forks",
- "keys_url": "https://api.github.com/repos/sbansal1999/testing-gh/keys{/key_id}",
- "collaborators_url": "https://api.github.com/repos/sbansal1999/testing-gh/collaborators{/collaborator}",
- "teams_url": "https://api.github.com/repos/sbansal1999/testing-gh/teams",
- "hooks_url": "https://api.github.com/repos/sbansal1999/testing-gh/hooks",
- "issue_events_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/events{/number}",
- "events_url": "https://api.github.com/repos/sbansal1999/testing-gh/events",
- "assignees_url": "https://api.github.com/repos/sbansal1999/testing-gh/assignees{/user}",
- "branches_url": "https://api.github.com/repos/sbansal1999/testing-gh/branches{/branch}",
- "tags_url": "https://api.github.com/repos/sbansal1999/testing-gh/tags",
- "blobs_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/blobs{/sha}",
- "git_tags_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/tags{/sha}",
- "git_refs_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/refs{/sha}",
- "trees_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/trees{/sha}",
- "statuses_url": "https://api.github.com/repos/sbansal1999/testing-gh/statuses/{sha}",
- "languages_url": "https://api.github.com/repos/sbansal1999/testing-gh/languages",
- "stargazers_url": "https://api.github.com/repos/sbansal1999/testing-gh/stargazers",
- "contributors_url": "https://api.github.com/repos/sbansal1999/testing-gh/contributors",
- "subscribers_url": "https://api.github.com/repos/sbansal1999/testing-gh/subscribers",
- "subscription_url": "https://api.github.com/repos/sbansal1999/testing-gh/subscription",
- "commits_url": "https://api.github.com/repos/sbansal1999/testing-gh/commits{/sha}",
- "git_commits_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/commits{/sha}",
- "comments_url": "https://api.github.com/repos/sbansal1999/testing-gh/comments{/number}",
- "issue_comment_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/comments{/number}",
- "contents_url": "https://api.github.com/repos/sbansal1999/testing-gh/contents/{+path}",
- "compare_url": "https://api.github.com/repos/sbansal1999/testing-gh/compare/{base}...{head}",
- "merges_url": "https://api.github.com/repos/sbansal1999/testing-gh/merges",
- "archive_url": "https://api.github.com/repos/sbansal1999/testing-gh/{archive_format}{/ref}",
- "downloads_url": "https://api.github.com/repos/sbansal1999/testing-gh/downloads",
- "issues_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues{/number}",
- "pulls_url": "https://api.github.com/repos/sbansal1999/testing-gh/pulls{/number}",
- "milestones_url": "https://api.github.com/repos/sbansal1999/testing-gh/milestones{/number}",
- "notifications_url": "https://api.github.com/repos/sbansal1999/testing-gh/notifications{?since,all,participating}",
- "labels_url": "https://api.github.com/repos/sbansal1999/testing-gh/labels{/name}",
- "releases_url": "https://api.github.com/repos/sbansal1999/testing-gh/releases{/id}",
- "deployments_url": "https://api.github.com/repos/sbansal1999/testing-gh/deployments",
- "created_at": "2023-04-02T09:31:40Z",
- "updated_at": "2023-04-02T09:31:40Z",
- "pushed_at": "2023-06-28T17:27:54Z",
- "git_url": "git://github.com/sbansal1999/testing-gh.git",
- "ssh_url": "[email protected]:sbansal1999/testing-gh.git",
- "clone_url": "https://github.com/sbansal1999/testing-gh.git",
- "svn_url": "https://github.com/sbansal1999/testing-gh",
- "homepage": null,
- "size": 2,
- "stargazers_count": 0,
- "watchers_count": 0,
- "language": null,
- "has_issues": true,
- "has_projects": true,
- "has_downloads": true,
- "has_wiki": true,
- "has_pages": false,
- "has_discussions": true,
- "forks_count": 0,
- "mirror_url": null,
- "archived": false,
- "disabled": false,
- "open_issues_count": 9,
- "license": null,
- "allow_forking": true,
- "is_template": false,
- "web_commit_signoff_required": false,
- "topics": [],
- "visibility": "public",
- "forks": 0,
- "open_issues": 9,
- "watchers": 0,
- "default_branch": "fixing-typo"
- },
- "sender": {
- "login": "sbansal1999",
- "id": 35286603,
- "node_id": "MDQ6VXNlcjM1Mjg2NjAz",
- "avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
- "gravatar_id": "",
- "url": "https://api.github.com/users/sbansal1999",
- "html_url": "https://github.com/sbansal1999",
- "followers_url": "https://api.github.com/users/sbansal1999/followers",
- "following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
- "gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
- "starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
- "subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
- "organizations_url": "https://api.github.com/users/sbansal1999/orgs",
- "repos_url": "https://api.github.com/users/sbansal1999/repos",
- "events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
- "received_events_url": "https://api.github.com/users/sbansal1999/received_events",
- "type": "User",
- "site_admin": false
- }
-}
diff --git a/zerver/webhooks/github/fixtures/discussion__answered.json b/zerver/webhooks/github/fixtures/discussion__answered.json
new file mode 100644
index 00000000000..3e962e862f4
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__answered.json
@@ -0,0 +1,258 @@
+{
+ "action": "answered",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224167,
+ "node_id": "DIC_kwDONEtUIs4Ck4xn",
+ "repository_id": 877351970,
+ "emoji": ":pray:",
+ "name": "Q&A",
+ "description": "Ask the community for help",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "q-a",
+ "is_answerable": true
+ },
+ "answer_html_url": "https://github.com/Niloth-p/webhook-tester/discussions/5#discussioncomment-11460065",
+ "answer_chosen_at": "2024-12-04T16:46:38.000+05:30",
+ "answer_chosen_by": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/5",
+ "id": 7609644,
+ "node_id": "D_kwDONEtUIs4AdB0s",
+ "number": 5,
+ "title": "Understanding Project Directory Structure",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 1,
+ "created_at": "2024-12-04T11:11:30Z",
+ "updated_at": "2024-12-04T11:16:38Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Can someone explain the reasoning behind the project's directory structure? I'm having trouble finding where certain files are supposed to go.",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/5/reactions",
+ "total_count": 0,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 0,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/5/timeline"
+ },
+ "answer": {
+ "id": 11460065,
+ "node_id": "DC_kwDONEtUIs4Art3h",
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/5#discussioncomment-11460065",
+ "parent_id": null,
+ "child_comment_count": 0,
+ "repository_url": "Niloth-p/webhook-tester",
+ "discussion_id": 7609644,
+ "author_association": "OWNER",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "created_at": "2024-12-04T11:12:10Z",
+ "updated_at": "2024-12-04T11:12:10Z",
+ "body": "If you're looking for a detailed explanation of the project structure, I'd recommend checking out our CONTRIBUTING.md file. It includes a breakdown of the different directories and files, as well as some guidelines for contributing to the project.",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/comments/11460065/reactions",
+ "total_count": 0,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 0,
+ "eyes": 0
+ }
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__category_changed.json b/zerver/webhooks/github/fixtures/discussion__category_changed.json
new file mode 100644
index 00000000000..440f4d3b2b0
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__category_changed.json
@@ -0,0 +1,208 @@
+{
+ "action": "category_changed",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:52:52Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 1,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 1,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "changes": {
+ "category": {
+ "from": {
+ "id": 43224166,
+ "node_id": "DIC_kwDONEtUIs4Ck4xm",
+ "repository_id": 877351970,
+ "emoji": ":speech_balloon:",
+ "name": "General",
+ "description": "Chat about anything and everything here",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "general",
+ "is_answerable": false
+ }
+ }
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__closed.json b/zerver/webhooks/github/fixtures/discussion__closed.json
new file mode 100644
index 00000000000..f5a6820949c
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__closed.json
@@ -0,0 +1,192 @@
+{
+ "action": "closed",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "closed",
+ "state_reason": "resolved",
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:55:57Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 2,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 2,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Cordelia",
+ "id": 139634087,
+ "node_id": "U_kgDOCFKlpw",
+ "avatar_url": "https://avatars.githubusercontent.com/u/139634087?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__created.json b/zerver/webhooks/github/fixtures/discussion__created.json
new file mode 100644
index 00000000000..257a1ceab8a
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__created.json
@@ -0,0 +1,192 @@
+{
+ "action": "created",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224166,
+ "node_id": "DIC_kwDONEtUIs4Ck4xm",
+ "repository_id": 877351970,
+ "emoji": ":speech_balloon:",
+ "name": "General",
+ "description": "Chat about anything and everything here",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "general",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:36:57Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 0,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 0,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 1,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 1,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__deleted.json b/zerver/webhooks/github/fixtures/discussion__deleted.json
new file mode 100644
index 00000000000..18b31fa9dd8
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__deleted.json
@@ -0,0 +1,192 @@
+{
+ "action": "deleted",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224166,
+ "node_id": "DIC_kwDONEtUIs4Ck4xm",
+ "repository_id": 877351970,
+ "emoji": ":speech_balloon:",
+ "name": "General",
+ "description": "Chat about anything and everything here",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "general",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:43:14Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 1,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 1,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 1,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 1,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__edited_body.json b/zerver/webhooks/github/fixtures/discussion__edited_body.json
new file mode 100644
index 00000000000..04f436b9347
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__edited_body.json
@@ -0,0 +1,197 @@
+{
+ "action": "edited",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": "reopened",
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T11:03:23Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\r\nAny advice would be greatly appreciated!",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 2,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 2,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "changes": {
+ "body": {
+ "from": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?"
+ }
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__edited_title.json b/zerver/webhooks/github/fixtures/discussion__edited_title.json
new file mode 100644
index 00000000000..3ccb55dd76c
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__edited_title.json
@@ -0,0 +1,197 @@
+{
+ "action": "edited",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Good Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": "reopened",
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T11:03:23Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\r\nAny advice would be greatly appreciated!",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 2,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 2,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "changes": {
+ "title": {
+ "from": "Tips for Writing Clear and Concise Commit Messages"
+ }
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__labeled.json b/zerver/webhooks/github/fixtures/discussion__labeled.json
new file mode 100644
index 00000000000..3acf291fd53
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__labeled.json
@@ -0,0 +1,229 @@
+{
+ "action": "labeled",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [
+ {
+ "id": 7646198039,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Fw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/documentation",
+ "name": "documentation",
+ "color": "0075ca",
+ "default": true,
+ "description": "Improvements or additions to documentation"
+ },
+ {
+ "id": 7646198051,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Iw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/enhancement",
+ "name": "enhancement",
+ "color": "a2eeef",
+ "default": true,
+ "description": "New feature or request"
+ },
+ {
+ "id": 7646198079,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Pw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/question",
+ "name": "question",
+ "color": "d876e3",
+ "default": true,
+ "description": "Further information is requested"
+ }
+ ],
+ "state": "open",
+ "state_reason": "reopened",
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T11:03:23Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\r\nAny advice would be greatly appreciated!",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 2,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 2,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "label": {
+ "id": 7646198051,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Iw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/enhancement",
+ "name": "enhancement",
+ "color": "a2eeef",
+ "default": true,
+ "description": "New feature or request"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__locked.json b/zerver/webhooks/github/fixtures/discussion__locked.json
new file mode 100644
index 00000000000..e7d450df1d5
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__locked.json
@@ -0,0 +1,192 @@
+{
+ "action": "locked",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224166,
+ "node_id": "DIC_kwDONEtUIs4Ck4xm",
+ "repository_id": 877351970,
+ "emoji": ":speech_balloon:",
+ "name": "General",
+ "description": "Chat about anything and everything here",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "general",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "locked",
+ "state_reason": null,
+ "locked": true,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:42:57Z",
+ "author_association": "OWNER",
+ "active_lock_reason": "resolved",
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 0,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 0,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 1,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 1,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__pinned.json b/zerver/webhooks/github/fixtures/discussion__pinned.json
new file mode 100644
index 00000000000..d27750c9f53
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__pinned.json
@@ -0,0 +1,192 @@
+{
+ "action": "pinned",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224166,
+ "node_id": "DIC_kwDONEtUIs4Ck4xm",
+ "repository_id": 877351970,
+ "emoji": ":speech_balloon:",
+ "name": "General",
+ "description": "Chat about anything and everything here",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "general",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:43:14Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 1,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 1,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 1,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 1,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__reopened.json b/zerver/webhooks/github/fixtures/discussion__reopened.json
new file mode 100644
index 00000000000..a81bec20a52
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__reopened.json
@@ -0,0 +1,192 @@
+{
+ "action": "reopened",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": "reopened",
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:59:09Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 2,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 2,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__transferred.json b/zerver/webhooks/github/fixtures/discussion__transferred.json
new file mode 100644
index 00000000000..8767e40327a
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__transferred.json
@@ -0,0 +1,400 @@
+{
+ "action": "transferred",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [
+ {
+ "id": 7646198039,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Fw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/documentation",
+ "name": "documentation",
+ "color": "0075ca",
+ "default": true,
+ "description": "Improvements or additions to documentation"
+ },
+ {
+ "id": 7646198079,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Pw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/question",
+ "name": "question",
+ "color": "d876e3",
+ "default": true,
+ "description": "Further information is requested"
+ }
+ ],
+ "state": "open",
+ "state_reason": "reopened",
+ "locked": false,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T11:03:23Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\r\nAny advice would be greatly appreciated!",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 0,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 0,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "changes": {
+ "new_discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester",
+ "category": {
+ "id": 43224622,
+ "node_id": "DIC_kwDONYzgms4Ck44u",
+ "repository_id": 898424986,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T16:51:58.000+05:30",
+ "updated_at": "2024-12-04T16:51:58.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/another-webhook-tester/discussions/1",
+ "id": 7609689,
+ "node_id": "D_kwDONYzgms4AdB1Z",
+ "number": 1,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [
+ {
+ "id": 7837998571,
+ "node_id": "LA_kwDONYzgms8AAAAB0y5d6w",
+ "url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/labels/documentation",
+ "name": "documentation",
+ "color": "0075ca",
+ "default": true,
+ "description": "Improvements or additions to documentation"
+ },
+ {
+ "id": 7837998619,
+ "node_id": "LA_kwDONYzgms8AAAAB0y5eGw",
+ "url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/labels/question",
+ "name": "question",
+ "color": "d876e3",
+ "default": true,
+ "description": "Further information is requested"
+ }
+ ],
+ "state": "open",
+ "state_reason": "reopened",
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T11:22:29Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\r\nAny advice would be greatly appreciated!",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/discussions/1/reactions",
+ "total_count": 2,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 2,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/discussions/1/timeline"
+ },
+ "new_repository": {
+ "id": 898424986,
+ "node_id": "R_kgDONYzgmg",
+ "name": "another-webhook-tester",
+ "full_name": "Niloth-p/another-webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/another-webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/another-webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/another-webhook-tester/deployments",
+ "created_at": "2024-12-04T11:20:58Z",
+ "updated_at": "2024-12-04T11:21:43Z",
+ "pushed_at": "2024-12-04T11:21:40Z",
+ "git_url": "git://github.com/Niloth-p/another-webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/another-webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/another-webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/another-webhook-tester",
+ "homepage": null,
+ "size": 0,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 0,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 0,
+ "watchers": 0,
+ "default_branch": "main"
+ }
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__unanswered.json b/zerver/webhooks/github/fixtures/discussion__unanswered.json
new file mode 100644
index 00000000000..66b87b2406c
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__unanswered.json
@@ -0,0 +1,238 @@
+{
+ "action": "unanswered",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224167,
+ "node_id": "DIC_kwDONEtUIs4Ck4xn",
+ "repository_id": 877351970,
+ "emoji": ":pray:",
+ "name": "Q&A",
+ "description": "Ask the community for help",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "q-a",
+ "is_answerable": true
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/5",
+ "id": 7609644,
+ "node_id": "D_kwDONEtUIs4AdB0s",
+ "number": 5,
+ "title": "Understanding Project Directory Structure",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T11:11:30Z",
+ "updated_at": "2024-12-04T11:14:52Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Can someone explain the reasoning behind the project's directory structure? I'm having trouble finding where certain files are supposed to go.",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/5/reactions",
+ "total_count": 0,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 0,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/5/timeline"
+ },
+ "old_answer": {
+ "id": 11460059,
+ "node_id": "DC_kwDONEtUIs4Art3b",
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/5#discussioncomment-11460059",
+ "parent_id": null,
+ "child_comment_count": 0,
+ "repository_url": "Niloth-p/webhook-tester",
+ "discussion_id": 7609644,
+ "author_association": "OWNER",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "created_at": "2024-12-04T11:11:52Z",
+ "updated_at": "2024-12-04T11:11:53Z",
+ "body": "We follow a modular approach to organizing our code. Each feature or module has its own subdirectory within the src folder. This helps keep related files together and makes it easier to manage dependencies.",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/comments/11460059/reactions",
+ "total_count": 0,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 0,
+ "eyes": 0
+ }
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Cordelia",
+ "id": 139634087,
+ "node_id": "U_kgDOCFKlpw",
+ "avatar_url": "https://avatars.githubusercontent.com/u/139634087?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__unlabeled.json b/zerver/webhooks/github/fixtures/discussion__unlabeled.json
new file mode 100644
index 00000000000..8f12f282d07
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__unlabeled.json
@@ -0,0 +1,220 @@
+{
+ "action": "unlabeled",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224168,
+ "node_id": "DIC_kwDONEtUIs4Ck4xo",
+ "repository_id": 877351970,
+ "emoji": ":bulb:",
+ "name": "Ideas",
+ "description": "Share ideas for new features",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "ideas",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [
+ {
+ "id": 7646198039,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Fw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/documentation",
+ "name": "documentation",
+ "color": "0075ca",
+ "default": true,
+ "description": "Improvements or additions to documentation"
+ },
+ {
+ "id": 7646198079,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Pw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/question",
+ "name": "question",
+ "color": "d876e3",
+ "default": true,
+ "description": "Further information is requested"
+ }
+ ],
+ "state": "open",
+ "state_reason": "reopened",
+ "locked": false,
+ "comments": 2,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T11:03:23Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\r\nAny advice would be greatly appreciated!",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 2,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 2,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "label": {
+ "id": 7646198051,
+ "node_id": "LA_kwDONEtUIs8AAAABx7-5Iw",
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels/enhancement",
+ "name": "enhancement",
+ "color": "a2eeef",
+ "default": true,
+ "description": "New feature or request"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 2,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 2,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__unlocked.json b/zerver/webhooks/github/fixtures/discussion__unlocked.json
new file mode 100644
index 00000000000..a8c5b7df272
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__unlocked.json
@@ -0,0 +1,192 @@
+{
+ "action": "unlocked",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224166,
+ "node_id": "DIC_kwDONEtUIs4Ck4xm",
+ "repository_id": 877351970,
+ "emoji": ":speech_balloon:",
+ "name": "General",
+ "description": "Chat about anything and everything here",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "general",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:43:14Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 1,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 1,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 1,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 1,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/fixtures/discussion__unpinned.json b/zerver/webhooks/github/fixtures/discussion__unpinned.json
new file mode 100644
index 00000000000..2ad25646e91
--- /dev/null
+++ b/zerver/webhooks/github/fixtures/discussion__unpinned.json
@@ -0,0 +1,192 @@
+{
+ "action": "unpinned",
+ "discussion": {
+ "repository_url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "category": {
+ "id": 43224166,
+ "node_id": "DIC_kwDONEtUIs4Ck4xm",
+ "repository_id": 877351970,
+ "emoji": ":speech_balloon:",
+ "name": "General",
+ "description": "Chat about anything and everything here",
+ "created_at": "2024-12-04T15:45:23.000+05:30",
+ "updated_at": "2024-12-04T15:45:23.000+05:30",
+ "slug": "general",
+ "is_answerable": false
+ },
+ "answer_html_url": null,
+ "answer_chosen_at": null,
+ "answer_chosen_by": null,
+ "html_url": "https://github.com/Niloth-p/webhook-tester/discussions/3",
+ "id": 7609509,
+ "node_id": "D_kwDONEtUIs4AdByl",
+ "number": 3,
+ "title": "Tips for Writing Clear and Concise Commit Messages",
+ "user": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "labels": [],
+ "state": "open",
+ "state_reason": null,
+ "locked": false,
+ "comments": 0,
+ "created_at": "2024-12-04T10:36:57Z",
+ "updated_at": "2024-12-04T10:43:14Z",
+ "author_association": "OWNER",
+ "active_lock_reason": null,
+ "body": "Writing good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?",
+ "reactions": {
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/reactions",
+ "total_count": 1,
+ "+1": 0,
+ "-1": 0,
+ "laugh": 0,
+ "hooray": 0,
+ "confused": 0,
+ "heart": 0,
+ "rocket": 1,
+ "eyes": 0
+ },
+ "timeline_url": "https://api.github.com/repos/Niloth-p/webhook-tester/discussions/3/timeline"
+ },
+ "repository": {
+ "id": 877351970,
+ "node_id": "R_kgDONEtUIg",
+ "name": "webhook-tester",
+ "full_name": "Niloth-p/webhook-tester",
+ "private": true,
+ "owner": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ },
+ "html_url": "https://github.com/Niloth-p/webhook-tester",
+ "description": null,
+ "fork": false,
+ "url": "https://api.github.com/repos/Niloth-p/webhook-tester",
+ "forks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/forks",
+ "keys_url": "https://api.github.com/repos/Niloth-p/webhook-tester/keys{/key_id}",
+ "collaborators_url": "https://api.github.com/repos/Niloth-p/webhook-tester/collaborators{/collaborator}",
+ "teams_url": "https://api.github.com/repos/Niloth-p/webhook-tester/teams",
+ "hooks_url": "https://api.github.com/repos/Niloth-p/webhook-tester/hooks",
+ "issue_events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/events{/number}",
+ "events_url": "https://api.github.com/repos/Niloth-p/webhook-tester/events",
+ "assignees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/assignees{/user}",
+ "branches_url": "https://api.github.com/repos/Niloth-p/webhook-tester/branches{/branch}",
+ "tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/tags",
+ "blobs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/blobs{/sha}",
+ "git_tags_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/tags{/sha}",
+ "git_refs_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/refs{/sha}",
+ "trees_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/trees{/sha}",
+ "statuses_url": "https://api.github.com/repos/Niloth-p/webhook-tester/statuses/{sha}",
+ "languages_url": "https://api.github.com/repos/Niloth-p/webhook-tester/languages",
+ "stargazers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/stargazers",
+ "contributors_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contributors",
+ "subscribers_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscribers",
+ "subscription_url": "https://api.github.com/repos/Niloth-p/webhook-tester/subscription",
+ "commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/commits{/sha}",
+ "git_commits_url": "https://api.github.com/repos/Niloth-p/webhook-tester/git/commits{/sha}",
+ "comments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/comments{/number}",
+ "issue_comment_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues/comments{/number}",
+ "contents_url": "https://api.github.com/repos/Niloth-p/webhook-tester/contents/{+path}",
+ "compare_url": "https://api.github.com/repos/Niloth-p/webhook-tester/compare/{base}...{head}",
+ "merges_url": "https://api.github.com/repos/Niloth-p/webhook-tester/merges",
+ "archive_url": "https://api.github.com/repos/Niloth-p/webhook-tester/{archive_format}{/ref}",
+ "downloads_url": "https://api.github.com/repos/Niloth-p/webhook-tester/downloads",
+ "issues_url": "https://api.github.com/repos/Niloth-p/webhook-tester/issues{/number}",
+ "pulls_url": "https://api.github.com/repos/Niloth-p/webhook-tester/pulls{/number}",
+ "milestones_url": "https://api.github.com/repos/Niloth-p/webhook-tester/milestones{/number}",
+ "notifications_url": "https://api.github.com/repos/Niloth-p/webhook-tester/notifications{?since,all,participating}",
+ "labels_url": "https://api.github.com/repos/Niloth-p/webhook-tester/labels{/name}",
+ "releases_url": "https://api.github.com/repos/Niloth-p/webhook-tester/releases{/id}",
+ "deployments_url": "https://api.github.com/repos/Niloth-p/webhook-tester/deployments",
+ "created_at": "2024-10-23T14:00:56Z",
+ "updated_at": "2024-10-23T15:20:20Z",
+ "pushed_at": "2024-10-23T14:30:45Z",
+ "git_url": "git://github.com/Niloth-p/webhook-tester.git",
+ "ssh_url": "[email protected]:Niloth-p/webhook-tester.git",
+ "clone_url": "https://github.com/Niloth-p/webhook-tester.git",
+ "svn_url": "https://github.com/Niloth-p/webhook-tester",
+ "homepage": null,
+ "size": 1,
+ "stargazers_count": 0,
+ "watchers_count": 0,
+ "language": null,
+ "has_issues": true,
+ "has_projects": true,
+ "has_downloads": true,
+ "has_wiki": false,
+ "has_pages": false,
+ "has_discussions": true,
+ "forks_count": 0,
+ "mirror_url": null,
+ "archived": false,
+ "disabled": false,
+ "open_issues_count": 1,
+ "license": null,
+ "allow_forking": true,
+ "is_template": false,
+ "web_commit_signoff_required": false,
+ "topics": [],
+ "visibility": "private",
+ "forks": 0,
+ "open_issues": 1,
+ "watchers": 0,
+ "default_branch": "main"
+ },
+ "sender": {
+ "login": "Niloth-p",
+ "id": 20315308,
+ "node_id": "MDQ6VXNlcjIwMzE1MzA4",
+ "avatar_url": "https://avatars.githubusercontent.com/u/20315308?v=4",
+ "gravatar_id": "",
+ "url": "https://api.github.com/users/Niloth-p",
+ "html_url": "https://github.com/Niloth-p",
+ "followers_url": "https://api.github.com/users/Niloth-p/followers",
+ "following_url": "https://api.github.com/users/Niloth-p/following{/other_user}",
+ "gists_url": "https://api.github.com/users/Niloth-p/gists{/gist_id}",
+ "starred_url": "https://api.github.com/users/Niloth-p/starred{/owner}{/repo}",
+ "subscriptions_url": "https://api.github.com/users/Niloth-p/subscriptions",
+ "organizations_url": "https://api.github.com/users/Niloth-p/orgs",
+ "repos_url": "https://api.github.com/users/Niloth-p/repos",
+ "events_url": "https://api.github.com/users/Niloth-p/events{/privacy}",
+ "received_events_url": "https://api.github.com/users/Niloth-p/received_events",
+ "type": "User",
+ "user_view_type": "public",
+ "site_admin": false
+ }
+}
diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.py
index 00ed070516a..c86297085e0 100644
--- a/zerver/webhooks/github/tests.py
+++ b/zerver/webhooks/github/tests.py
@@ -12,7 +12,9 @@ TOPIC_DEPLOYMENT = "public-repo / Deployment on production"
TOPIC_ORGANIZATION = "baxterandthehackers organization"
TOPIC_BRANCH = "public-repo / changes"
TOPIC_WIKI = "public-repo / wiki pages"
-TOPIC_DISCUSSION = "testing-gh discussion #20: Lets discuss"
+TOPIC_DISCUSSION = "webhook-tester discussion #3: Tips for Writing Clear and ..."
+TOPIC_DISCUSSION_ANSWERS = "webhook-tester discussion #5: Understanding Project Direc..."
+TOPIC_DISCUSSION_COMMENT = "testing-gh discussion #20: Lets discuss"
TOPIC_SPONSORS = "sponsors"
@@ -629,13 +631,80 @@ A temporary team so that I can get some webhook fixtures!
)
self.assertTrue(stack_info)
- def test_discussion_msg(self) -> None:
- expected_message = "sbansal1999 created [discussion #20](https://github.com/sbansal1999/testing-gh/discussions/20) in General:\n\n~~~ quote\n### Lets discuss\nSome random text about which no one cares.\r\n\n~~~"
- self.check_webhook("discussion", TOPIC_DISCUSSION, expected_message)
+ def test_discussion_answered(self) -> None:
+ expected_message = "Niloth-p marked [comment #11460065](https://github.com/Niloth-p/webhook-tester/discussions/5#discussioncomment-11460065) as the answer:\n\n~~~ quote\nIf you're looking for a detailed explanation of the project structure, I'd recommend checking out our CONTRIBUTING.md file. It includes a breakdown of the different directories and files, as well as some guidelines for contributing to the project.\n~~~"
+ self.check_webhook("discussion__answered", TOPIC_DISCUSSION_ANSWERS, expected_message)
+
+ def test_discussion_category_changed(self) -> None:
+ expected_message = "Niloth-p changed the category of [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3) from General to Ideas."
+ self.check_webhook("discussion__category_changed", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_category_changed_with_custom_topic_in_url(self) -> None:
+ self.url = self.build_webhook_url(topic="discussions")
+ expected_topic_name = "discussions"
+ expected_message = "Niloth-p changed the category of [discussion #3 Tips for Writing Clear and Concise Commit Messages](https://github.com/Niloth-p/webhook-tester/discussions/3) from General to Ideas."
+ self.check_webhook("discussion__category_changed", expected_topic_name, expected_message)
+
+ def test_discussion_created(self) -> None:
+ expected_message = "Niloth-p created [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3) in General:\n\n~~~ quote\n### Tips for Writing Clear and Concise Commit Messages\nWriting good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\n~~~"
+ self.check_webhook("discussion__created", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_closed(self) -> None:
+ expected_message = "Cordelia closed [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3) as resolved."
+ self.check_webhook("discussion__closed", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_deleted(self) -> None:
+ expected_message = "Niloth-p deleted discussion #3."
+ self.check_webhook("discussion__deleted", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_edited_title(self) -> None:
+ expected_topic = "webhook-tester discussion #3: Tips for Writing Good Commi..."
+ expected_message = "Niloth-p edited the title of [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3):\n\n~~~ quote\n### Tips for Writing Good Commit Messages\n~~~"
+ self.check_webhook("discussion__edited_title", expected_topic, expected_message)
+
+ def test_discussion_edited_body(self) -> None:
+ expected_message = "Niloth-p edited [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3):\n\n~~~ quote\nWriting good commit messages is an art, but it's also an important part of maintaining a clear and understandable project history. What are some tips and tricks you've learned for writing clear and concise commit messages? Do you have any favorite templates or formats?\r\nAny advice would be greatly appreciated!\n~~~"
+ self.check_webhook("discussion__edited_body", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_labeled(self) -> None:
+ expected_message = "Niloth-p added the enhancement label to [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3)."
+ self.check_webhook("discussion__labeled", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_locked(self) -> None:
+ expected_message = "Niloth-p locked [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3) as resolved."
+ self.check_webhook("discussion__locked", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_pinned(self) -> None:
+ expected_message = "Niloth-p pinned [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3)."
+ self.check_webhook("discussion__pinned", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_reopened(self) -> None:
+ expected_message = "Niloth-p reopened [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3)."
+ self.check_webhook("discussion__reopened", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_transferred(self) -> None:
+ expected_message = "Niloth-p transferred discussion #3 from webhook-tester to another-webhook-tester as [discussion #1](https://github.com/Niloth-p/webhook-tester/discussions/3)."
+ self.check_webhook("discussion__transferred", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_unlabeled(self) -> None:
+ expected_message = "Niloth-p removed the enhancement label from [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3)."
+ self.check_webhook("discussion__unlabeled", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_unlocked(self) -> None:
+ expected_message = "Niloth-p unlocked [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3)."
+ self.check_webhook("discussion__unlocked", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_unpinned(self) -> None:
+ expected_message = "Niloth-p unpinned [discussion #3](https://github.com/Niloth-p/webhook-tester/discussions/3)."
+ self.check_webhook("discussion__unpinned", TOPIC_DISCUSSION, expected_message)
+
+ def test_discussion_unanswered(self) -> None:
+ expected_message = "Cordelia marked [comment #11460059](https://github.com/Niloth-p/webhook-tester/discussions/5#discussioncomment-11460059) as not the answer."
+ self.check_webhook("discussion__unanswered", TOPIC_DISCUSSION_ANSWERS, expected_message)
def test_discussion_comment_msg(self) -> None:
expected_message = "sbansal1999 [commented](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\n~~~"
- self.check_webhook("discussion_comment", TOPIC_DISCUSSION, expected_message)
+ self.check_webhook("discussion_comment", TOPIC_DISCUSSION_COMMENT, expected_message)
def test_discussion_comment_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic="notifications")
@@ -645,7 +714,7 @@ A temporary team so that I can get some webhook fixtures!
def test_discussion_comment_edited_msg(self) -> None:
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)
+ self.check_webhook("discussion_comment__edited", TOPIC_DISCUSSION_COMMENT, expected_message)
def test_comment_edited_unchanged_skipped(self) -> None:
self.check_webhook(
diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.py
index ed1970bb5c3..f5526f24bcf 100644
--- a/zerver/webhooks/github/view.py
+++ b/zerver/webhooks/github/view.py
@@ -4,6 +4,7 @@ from datetime import datetime, timezone
from django.http import HttpRequest, HttpResponse
from pydantic import Json
+from typing_extensions import override
from zerver.decorator import log_unsupported_webhook_event, webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventTypeError
@@ -38,7 +39,21 @@ from zerver.models import UserProfile
fixture_to_headers = get_http_headers_from_filename("HTTP_X_GITHUB_EVENT")
TOPIC_FOR_DISCUSSION = "{repo} discussion #{number}: {title}"
-DISCUSSION_TEMPLATE = "{author} created [discussion #{discussion_id}]({url}) in {category}:\n\n~~~ quote\n### {title}\n{body}\n~~~"
+DISCUSSION_TEMPLATES = {
+ "created": "{sender} created [discussion #{discussion_number}]({url}) in {category}:\n\n~~~ quote\n### {title}\n{body}\n~~~",
+ "generic_action": "{sender} {action} [discussion #{discussion_number}{configured_title}]({url}).",
+ "deleted": "{sender} {action} discussion #{discussion_number}{configured_title}.",
+ "closed": "{sender} {action} [discussion #{discussion_number}{configured_title}]({url}) as {closed_reason}.",
+ "locked": "{sender} {action} [discussion #{discussion_number}{configured_title}]({url}{configured_title}){locked_reason}.",
+ "labeled": "{sender} added the {label} label to [discussion #{discussion_number}{configured_title}]({url}).",
+ "unlabeled": "{sender} removed the {label} label from [discussion #{discussion_number}{configured_title}]({url}).",
+ "category_changed": "{sender} changed the category of [discussion #{discussion_number}{configured_title}]({url}) from {old_category} to {category}.",
+ "transferred": "{sender} {action} discussion #{discussion_number}{configured_title} from {repository_name} to {new_repository_name} as [discussion #{new_discussion_number}]({url}).",
+ "answered": "{sender} marked [comment #{comment_id}]({answer_url}) as the answer:\n\n~~~ quote\n{answer_body}\n~~~",
+ "unanswered": "{sender} marked [comment #{comment_id}]({answer_url}) as not the answer.",
+ "edited_title": "{sender} edited the title of [discussion #{discussion_number}{configured_title}]({url}):\n\n~~~ quote\n### {title}\n~~~",
+ "edited_body": "{sender} edited [discussion #{discussion_number}{configured_title}]({url}):\n\n~~~ quote\n{body}\n~~~",
+}
class Helper:
@@ -303,16 +318,81 @@ def get_push_commits_body(helper: Helper) -> str:
)
+class LazyContext(dict[str, str | int]):
+ """Template rendering context for discussions."""
+
+ def __init__(self, payload: WildValue, include_title: bool) -> None:
+ super().__init__()
+ self.payload = payload
+ self.include_title = include_title
+ self.template_values: dict[str, Callable[[], str | int]] = {
+ "sender": lambda: get_sender_name(self.payload),
+ "author": lambda: self.payload["discussion"]["user"]["login"].tame(check_string),
+ "url": lambda: self.payload["discussion"]["html_url"].tame(check_string),
+ "action": lambda: self.payload["action"].tame(check_string),
+ "configured_title": lambda: f" {self.template_values['title']()}"
+ if self.include_title
+ else "",
+ "category": lambda: self.payload["discussion"]["category"]["name"].tame(check_string),
+ "title": lambda: self.payload["discussion"]["title"].tame(check_string),
+ "body": lambda: self.payload["discussion"]["body"].tame(check_string),
+ "repository_name": lambda: self.payload["repository"]["name"].tame(check_string),
+ "new_repository_name": lambda: self.payload["changes"]["new_repository"]["name"].tame(
+ check_string
+ ),
+ "discussion_number": lambda: self.payload["discussion"]["number"].tame(check_int),
+ "new_discussion_number": lambda: self.payload["changes"]["new_discussion"][
+ "number"
+ ].tame(check_int),
+ "label": lambda: self.payload["label"]["name"].tame(check_string),
+ "old_category": lambda: self.payload["changes"]["category"]["from"]["name"].tame(
+ check_string
+ ),
+ # locked_reason includes the " as " as prefix,
+ # because locked_reason could be null too, in which case,
+ # we drop this entire part from the message.
+ "locked_reason": lambda: f" as {self.payload['discussion']['active_lock_reason'].tame(check_string)}"
+ if self.payload["discussion"]["active_lock_reason"]
+ else "",
+ "closed_reason": lambda: self.payload["discussion"]["state_reason"].tame(check_string),
+ # answer_field is used to determine which payload field to use.
+ # It is either "answer" (for answered action)
+ # or "old_answer" (for unanswered action)
+ "answer_field": lambda: "old_answer"
+ if self.payload["action"].tame(check_string) == "unanswered"
+ else "answer",
+ "answer_url": lambda: self.payload[self.template_values["answer_field"]()][
+ "html_url"
+ ].tame(check_string),
+ "answer_body": lambda: self.payload[self.template_values["answer_field"]()][
+ "body"
+ ].tame(check_string),
+ "comment_id": lambda: self.payload[self.template_values["answer_field"]()]["id"].tame(
+ check_int
+ ),
+ }
+
+ @override
+ def __getitem__(self, key: str) -> str | int:
+ return self.template_values[key]()
+
+
def get_discussion_body(helper: Helper) -> str:
payload = helper.payload
- return DISCUSSION_TEMPLATE.format(
- author=get_sender_name(payload),
- url=payload["discussion"]["html_url"].tame(check_string),
- body=payload["discussion"]["body"].tame(check_string),
- category=payload["discussion"]["category"]["name"].tame(check_string),
- discussion_id=payload["discussion"]["number"].tame(check_int),
- title=payload["discussion"]["title"].tame(check_string),
- )
+ action = get_discussion_action(payload)
+ DISCUSSION_TEMPLATE = DISCUSSION_TEMPLATES[action]
+ context = LazyContext(payload, helper.include_title)
+ return DISCUSSION_TEMPLATE.format_map(context)
+
+
+def get_discussion_action(payload: WildValue) -> str:
+ action = payload["action"].tame(check_string)
+ if action in ("unlocked", "pinned", "unpinned", "reopened"):
+ action = "generic_action"
+ if action == "edited":
+ edited_field = "body" if "body" in payload["changes"] else "title"
+ action = f"edited_{edited_field}"
+ return action
def get_discussion_comment_body(helper: Helper) -> str: