webhooks/github: Add support for pull request ready for review.

GitHub supports opening a draft/WIP pull request and then marking it
as ready for review later on. This PR supports the ready_for_review
action for pull_request events.

Signed-off-by: Hemanth V. Alluri <hdrive1999@gmail.com>
This commit is contained in:
Hemanth V. Alluri 2020-05-12 18:55:08 +05:30 committed by Tim Abbott
parent a9b434b354
commit 4dd957faa2
3 changed files with 503 additions and 0 deletions

View File

@ -0,0 +1,486 @@
{
"action": "ready_for_review",
"number": 2,
"pull_request": {
"url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/2",
"id": 416695222,
"node_id": "MDExOlB1bGxSZXF1ZXN0NDE2Njk1MjIy",
"html_url": "https://github.com/Hypro999/temp-test-github-webhook/pull/2",
"diff_url": "https://github.com/Hypro999/temp-test-github-webhook/pull/2.diff",
"patch_url": "https://github.com/Hypro999/temp-test-github-webhook/pull/2.patch",
"issue_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/2",
"number": 2,
"state": "open",
"locked": false,
"title": "Test",
"user": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
},
"body": "WIP -> Ready for review test.",
"created_at": "2020-05-12T12:33:03Z",
"updated_at": "2020-05-12T12:34:03Z",
"closed_at": null,
"merged_at": null,
"merge_commit_sha": null,
"assignee": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
},
"assignees": [
{
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
}
],
"requested_reviewers": [],
"requested_teams": [],
"labels": [],
"milestone": null,
"draft": false,
"commits_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/2/commits",
"review_comments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/2/comments",
"review_comment_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/comments{/number}",
"comments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/2/comments",
"statuses_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/statuses/4e538c4ff2c1e1d4150dd2cf2b1e1b8004aaeadb",
"head": {
"label": "Hypro999:test",
"ref": "test",
"sha": "4e538c4ff2c1e1d4150dd2cf2b1e1b8004aaeadb",
"user": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
},
"repo": {
"id": 263329224,
"node_id": "MDEwOlJlcG9zaXRvcnkyNjMzMjkyMjQ=",
"name": "temp-test-github-webhook",
"full_name": "Hypro999/temp-test-github-webhook",
"private": false,
"owner": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/Hypro999/temp-test-github-webhook",
"description": "testing the GitHub webhook",
"fork": false,
"url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook",
"forks_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/forks",
"keys_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/teams",
"hooks_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/hooks",
"issue_events_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/events{/number}",
"events_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/events",
"assignees_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/assignees{/user}",
"branches_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/branches{/branch}",
"tags_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/tags",
"blobs_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/statuses/{sha}",
"languages_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/languages",
"stargazers_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/stargazers",
"contributors_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/contributors",
"subscribers_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/subscribers",
"subscription_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/subscription",
"commits_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/contents/{+path}",
"compare_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/merges",
"archive_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/downloads",
"issues_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues{/number}",
"pulls_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls{/number}",
"milestones_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/milestones{/number}",
"notifications_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/labels{/name}",
"releases_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/releases{/id}",
"deployments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/deployments",
"created_at": "2020-05-12T12:25:21Z",
"updated_at": "2020-05-12T12:28:04Z",
"pushed_at": "2020-05-12T12:33:04Z",
"git_url": "git://github.com/Hypro999/temp-test-github-webhook.git",
"ssh_url": "git@github.com:Hypro999/temp-test-github-webhook.git",
"clone_url": "https://github.com/Hypro999/temp-test-github-webhook.git",
"svn_url": "https://github.com/Hypro999/temp-test-github-webhook",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 1,
"license": null,
"forks": 0,
"open_issues": 1,
"watchers": 0,
"default_branch": "master"
}
},
"base": {
"label": "Hypro999:master",
"ref": "master",
"sha": "070550d4fb89551cb55c1e9bd9f73ed2d8b10ae8",
"user": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
},
"repo": {
"id": 263329224,
"node_id": "MDEwOlJlcG9zaXRvcnkyNjMzMjkyMjQ=",
"name": "temp-test-github-webhook",
"full_name": "Hypro999/temp-test-github-webhook",
"private": false,
"owner": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/Hypro999/temp-test-github-webhook",
"description": "testing the GitHub webhook",
"fork": false,
"url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook",
"forks_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/forks",
"keys_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/teams",
"hooks_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/hooks",
"issue_events_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/events{/number}",
"events_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/events",
"assignees_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/assignees{/user}",
"branches_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/branches{/branch}",
"tags_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/tags",
"blobs_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/statuses/{sha}",
"languages_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/languages",
"stargazers_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/stargazers",
"contributors_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/contributors",
"subscribers_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/subscribers",
"subscription_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/subscription",
"commits_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/contents/{+path}",
"compare_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/merges",
"archive_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/downloads",
"issues_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues{/number}",
"pulls_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls{/number}",
"milestones_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/milestones{/number}",
"notifications_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/labels{/name}",
"releases_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/releases{/id}",
"deployments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/deployments",
"created_at": "2020-05-12T12:25:21Z",
"updated_at": "2020-05-12T12:28:04Z",
"pushed_at": "2020-05-12T12:33:04Z",
"git_url": "git://github.com/Hypro999/temp-test-github-webhook.git",
"ssh_url": "git@github.com:Hypro999/temp-test-github-webhook.git",
"clone_url": "https://github.com/Hypro999/temp-test-github-webhook.git",
"svn_url": "https://github.com/Hypro999/temp-test-github-webhook",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 1,
"license": null,
"forks": 0,
"open_issues": 1,
"watchers": 0,
"default_branch": "master"
}
},
"_links": {
"self": {
"href": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/2"
},
"html": {
"href": "https://github.com/Hypro999/temp-test-github-webhook/pull/2"
},
"issue": {
"href": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/2"
},
"comments": {
"href": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/2/comments"
},
"review_comments": {
"href": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/2/comments"
},
"review_comment": {
"href": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/comments{/number}"
},
"commits": {
"href": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls/2/commits"
},
"statuses": {
"href": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/statuses/4e538c4ff2c1e1d4150dd2cf2b1e1b8004aaeadb"
}
},
"author_association": "OWNER",
"merged": false,
"mergeable": null,
"rebaseable": null,
"mergeable_state": "unknown",
"merged_by": null,
"comments": 2,
"review_comments": 0,
"maintainer_can_modify": false,
"commits": 2,
"additions": 1,
"deletions": 0,
"changed_files": 1
},
"repository": {
"id": 263329224,
"node_id": "MDEwOlJlcG9zaXRvcnkyNjMzMjkyMjQ=",
"name": "temp-test-github-webhook",
"full_name": "Hypro999/temp-test-github-webhook",
"private": false,
"owner": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/Hypro999/temp-test-github-webhook",
"description": "testing the GitHub webhook",
"fork": false,
"url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook",
"forks_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/forks",
"keys_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/teams",
"hooks_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/hooks",
"issue_events_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/events{/number}",
"events_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/events",
"assignees_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/assignees{/user}",
"branches_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/branches{/branch}",
"tags_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/tags",
"blobs_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/statuses/{sha}",
"languages_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/languages",
"stargazers_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/stargazers",
"contributors_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/contributors",
"subscribers_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/subscribers",
"subscription_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/subscription",
"commits_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/contents/{+path}",
"compare_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/merges",
"archive_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/downloads",
"issues_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/issues{/number}",
"pulls_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/pulls{/number}",
"milestones_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/milestones{/number}",
"notifications_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/labels{/name}",
"releases_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/releases{/id}",
"deployments_url": "https://api.github.com/repos/Hypro999/temp-test-github-webhook/deployments",
"created_at": "2020-05-12T12:25:21Z",
"updated_at": "2020-05-12T12:28:04Z",
"pushed_at": "2020-05-12T12:33:04Z",
"git_url": "git://github.com/Hypro999/temp-test-github-webhook.git",
"ssh_url": "git@github.com:Hypro999/temp-test-github-webhook.git",
"clone_url": "https://github.com/Hypro999/temp-test-github-webhook.git",
"svn_url": "https://github.com/Hypro999/temp-test-github-webhook",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 1,
"license": null,
"forks": 0,
"open_issues": 1,
"watchers": 0,
"default_branch": "master"
},
"sender": {
"login": "Hypro999",
"id": 29123352,
"node_id": "MDQ6VXNlcjI5MTIzMzUy",
"avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Hypro999",
"html_url": "https://github.com/Hypro999",
"followers_url": "https://api.github.com/users/Hypro999/followers",
"following_url": "https://api.github.com/users/Hypro999/following{/other_user}",
"gists_url": "https://api.github.com/users/Hypro999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Hypro999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Hypro999/subscriptions",
"organizations_url": "https://api.github.com/users/Hypro999/orgs",
"repos_url": "https://api.github.com/users/Hypro999/repos",
"events_url": "https://api.github.com/users/Hypro999/events{/privacy}",
"received_events_url": "https://api.github.com/users/Hypro999/received_events",
"type": "User",
"site_admin": false
}
}

View File

@ -263,6 +263,10 @@ class GithubWebhookTest(WebhookTestCase):
expected_message = "eeshangarg unassigned [PR #1](https://github.com/zulip-test-org/helloworld/pull/1)."
self.send_and_test_stream_message('pull_request__unassigned', 'helloworld / PR #1 Mention that Zulip rocks!', expected_message)
def test_pull_request_ready_for_review_msg(self) -> None:
expected_message = "**Hypro999** has marked [PR #2](https://github.com/Hypro999/temp-test-github-webhook/pull/2) as ready for review."
self.send_and_test_stream_message('pull_request__ready_for_review', 'temp-test-github-webhook / PR #2 Test', expected_message)
def test_pull_request_review_requested_msg(self) -> None:
expected_message = "**eeshangarg** requested [showell](https://github.com/showell) for a review on [PR #1](https://github.com/eeshangarg/Scheduler/pull/1)."
self.send_and_test_stream_message('pull_request__review_requested', 'Scheduler / PR #1 This is just a test commit', expected_message)

View File

@ -276,6 +276,16 @@ def get_status_body(payload: Dict[str, Any]) -> str:
status
)
def get_pull_request_ready_for_review_body(payload: Dict[str, Any],
include_title: Optional[bool]=False) -> str:
message = "**{sender}** has marked [PR #{pr_number}]({pr_url}) as ready for review."
return message.format(
sender = get_sender_name(payload),
pr_number = payload['pull_request']['number'],
pr_url = payload['pull_request']['html_url']
)
def get_pull_request_review_body(payload: Dict[str, Any],
include_title: Optional[bool]=False) -> str:
title = "for #{} {}".format(
@ -456,6 +466,7 @@ EVENT_FUNCTION_MAPPER = {
'page_build': get_page_build_body,
'ping': get_ping_body,
'public': get_public_body,
'pull_request_ready_for_review': get_pull_request_ready_for_review_body,
'pull_request_review': get_pull_request_review_body,
'pull_request_review_comment': get_pull_request_review_comment_body,
'pull_request_review_requested': get_pull_request_review_requested_body,
@ -510,6 +521,8 @@ def get_event(request: HttpRequest, payload: Dict[str, Any], branches: Optional[
return 'closed_pull_request'
if action == 'review_requested':
return '{}_{}'.format(event, action)
if action == 'ready_for_review':
return 'pull_request_ready_for_review'
# Unsupported pull_request events
if action in ('labeled', 'unlabeled', 'review_request_removed'):
return None