diff --git a/mock_payloads/pull_request.labeled_two_labels.json b/mock_payloads/pull_request.labeled_two_labels_no_thread.json similarity index 100% rename from mock_payloads/pull_request.labeled_two_labels.json rename to mock_payloads/pull_request.labeled_two_labels_no_thread.json diff --git a/mock_payloads/pull_request.labeled_two_labels_with_thread.json b/mock_payloads/pull_request.labeled_two_labels_with_thread.json new file mode 100644 index 00000000..5ac29a39 --- /dev/null +++ b/mock_payloads/pull_request.labeled_two_labels_with_thread.json @@ -0,0 +1,474 @@ +{ + "action": "labeled", + "number": 4, + "pull_request": { + "url": "https://api.github.com/repos/xinyuluo/monorepo/pulls/4", + "id": 0, + "node_id": "00000000000000000000", + "html_url": "https://github.com/xinyuluo/monorepo/pull/4", + "diff_url": "https://github.com/xinyuluo/monorepo/pull/4.diff", + "patch_url": "https://github.com/xinyuluo/monorepo/pull/4.patch", + "issue_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/4", + "number": 4, + "state": "open", + "locked": false, + "title": "README update", + "user": { + "login": "xinyuluo", + "id": 0, + "node_id": "00000000000000000000", + "avatar_url": "https://avatars0.githubusercontent.com/u/000000?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xinyuluo", + "html_url": "https://github.com/xinyuluo", + "followers_url": "https://api.github.com/users/xinyuluo/followers", + "following_url": "https://api.github.com/users/xinyuluo/following{/other_user}", + "gists_url": "https://api.github.com/users/xinyuluo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xinyuluo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xinyuluo/subscriptions", + "organizations_url": "https://api.github.com/users/xinyuluo/orgs", + "repos_url": "https://api.github.com/users/xinyuluo/repos", + "events_url": "https://api.github.com/users/xinyuluo/events{/privacy}", + "received_events_url": "https://api.github.com/users/xinyuluo/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2020-05-21T05:55:56Z", + "updated_at": "2020-05-21T05:55:56Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [ + { + "id": 0, + "node_id": "00000000000000000000", + "url": "https://api.github.com/repos/xinyuluo/monorepo/labels/a1", + "name": "a1", + "color": "c5def5", + "default": false, + "description": "" + }, + { + "id": 0, + "node_id": "00000000000000000000", + "url": "https://api.github.com/repos/xinyuluo/monorepo/labels/backend", + "name": "backend", + "color": "c70ad8", + "default": false, + "description": "" + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/xinyuluo/monorepo/pulls/4/commits", + "review_comments_url": "https://api.github.com/repos/xinyuluo/monorepo/pulls/4/comments", + "review_comment_url": "https://api.github.com/repos/xinyuluo/monorepo/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/4/comments", + "statuses_url": "https://api.github.com/repos/xinyuluo/monorepo/statuses/cd92b75d1adfc5d5810445e3e3c4b019d4f7e3c0", + "head": { + "label": "xinyuluo:readme_update", + "ref": "readme_update", + "sha": "cd92b75d1adfc5d5810445e3e3c4b019d4f7e3c0", + "user": { + "login": "xinyuluo", + "id": 0, + "node_id": "00000000000000000000", + "avatar_url": "https://avatars0.githubusercontent.com/u/000000?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xinyuluo", + "html_url": "https://github.com/xinyuluo", + "followers_url": "https://api.github.com/users/xinyuluo/followers", + "following_url": "https://api.github.com/users/xinyuluo/following{/other_user}", + "gists_url": "https://api.github.com/users/xinyuluo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xinyuluo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xinyuluo/subscriptions", + "organizations_url": "https://api.github.com/users/xinyuluo/orgs", + "repos_url": "https://api.github.com/users/xinyuluo/repos", + "events_url": "https://api.github.com/users/xinyuluo/events{/privacy}", + "received_events_url": "https://api.github.com/users/xinyuluo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 0, + "node_id": "00000000000000000000", + "name": "monorepo", + "full_name": "xinyuluo/monorepo", + "private": true, + "owner": { + "login": "xinyuluo", + "id": 0, + "node_id": "00000000000000000000", + "avatar_url": "https://avatars0.githubusercontent.com/u/000000?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xinyuluo", + "html_url": "https://github.com/xinyuluo", + "followers_url": "https://api.github.com/users/xinyuluo/followers", + "following_url": "https://api.github.com/users/xinyuluo/following{/other_user}", + "gists_url": "https://api.github.com/users/xinyuluo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xinyuluo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xinyuluo/subscriptions", + "organizations_url": "https://api.github.com/users/xinyuluo/orgs", + "repos_url": "https://api.github.com/users/xinyuluo/repos", + "events_url": "https://api.github.com/users/xinyuluo/events{/privacy}", + "received_events_url": "https://api.github.com/users/xinyuluo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/xinyuluo/monorepo", + "description": "a test repository", + "fork": false, + "url": "https://api.github.com/repos/xinyuluo/monorepo", + "forks_url": "https://api.github.com/repos/xinyuluo/monorepo/forks", + "keys_url": "https://api.github.com/repos/xinyuluo/monorepo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/xinyuluo/monorepo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/xinyuluo/monorepo/teams", + "hooks_url": "https://api.github.com/repos/xinyuluo/monorepo/hooks", + "issue_events_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/events{/number}", + "events_url": "https://api.github.com/repos/xinyuluo/monorepo/events", + "assignees_url": "https://api.github.com/repos/xinyuluo/monorepo/assignees{/user}", + "branches_url": "https://api.github.com/repos/xinyuluo/monorepo/branches{/branch}", + "tags_url": "https://api.github.com/repos/xinyuluo/monorepo/tags", + "blobs_url": "https://api.github.com/repos/xinyuluo/monorepo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/xinyuluo/monorepo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/xinyuluo/monorepo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/xinyuluo/monorepo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/xinyuluo/monorepo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/xinyuluo/monorepo/languages", + "stargazers_url": "https://api.github.com/repos/xinyuluo/monorepo/stargazers", + "contributors_url": "https://api.github.com/repos/xinyuluo/monorepo/contributors", + "subscribers_url": "https://api.github.com/repos/xinyuluo/monorepo/subscribers", + "subscription_url": "https://api.github.com/repos/xinyuluo/monorepo/subscription", + "commits_url": "https://api.github.com/repos/xinyuluo/monorepo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/xinyuluo/monorepo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/xinyuluo/monorepo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/xinyuluo/monorepo/contents/{+path}", + "compare_url": "https://api.github.com/repos/xinyuluo/monorepo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/xinyuluo/monorepo/merges", + "archive_url": "https://api.github.com/repos/xinyuluo/monorepo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/xinyuluo/monorepo/downloads", + "issues_url": "https://api.github.com/repos/xinyuluo/monorepo/issues{/number}", + "pulls_url": "https://api.github.com/repos/xinyuluo/monorepo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/xinyuluo/monorepo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/xinyuluo/monorepo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/xinyuluo/monorepo/labels{/name}", + "releases_url": "https://api.github.com/repos/xinyuluo/monorepo/releases{/id}", + "deployments_url": "https://api.github.com/repos/xinyuluo/monorepo/deployments", + "created_at": "2020-05-21T03:03:30Z", + "updated_at": "2020-05-21T03:36:41Z", + "pushed_at": "2020-05-21T05:53:34Z", + "git_url": "git://github.com/xinyuluo/monorepo.git", + "ssh_url": "git@github.com:xinyuluo/monorepo.git", + "clone_url": "https://github.com/xinyuluo/monorepo.git", + "svn_url": "https://github.com/xinyuluo/monorepo", + "homepage": "", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": "OCaml", + "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": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master" + } + }, + "base": { + "label": "xinyuluo:master", + "ref": "master", + "sha": "074c4e4f15fccb905ed008993cae54830aa4fd83", + "user": { + "login": "xinyuluo", + "id": 0, + "node_id": "00000000000000000000", + "avatar_url": "https://avatars0.githubusercontent.com/u/000000?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xinyuluo", + "html_url": "https://github.com/xinyuluo", + "followers_url": "https://api.github.com/users/xinyuluo/followers", + "following_url": "https://api.github.com/users/xinyuluo/following{/other_user}", + "gists_url": "https://api.github.com/users/xinyuluo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xinyuluo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xinyuluo/subscriptions", + "organizations_url": "https://api.github.com/users/xinyuluo/orgs", + "repos_url": "https://api.github.com/users/xinyuluo/repos", + "events_url": "https://api.github.com/users/xinyuluo/events{/privacy}", + "received_events_url": "https://api.github.com/users/xinyuluo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 0, + "node_id": "00000000000000000000", + "name": "monorepo", + "full_name": "xinyuluo/monorepo", + "private": true, + "owner": { + "login": "xinyuluo", + "id": 0, + "node_id": "00000000000000000000", + "avatar_url": "https://avatars0.githubusercontent.com/u/000000?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xinyuluo", + "html_url": "https://github.com/xinyuluo", + "followers_url": "https://api.github.com/users/xinyuluo/followers", + "following_url": "https://api.github.com/users/xinyuluo/following{/other_user}", + "gists_url": "https://api.github.com/users/xinyuluo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xinyuluo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xinyuluo/subscriptions", + "organizations_url": "https://api.github.com/users/xinyuluo/orgs", + "repos_url": "https://api.github.com/users/xinyuluo/repos", + "events_url": "https://api.github.com/users/xinyuluo/events{/privacy}", + "received_events_url": "https://api.github.com/users/xinyuluo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/xinyuluo/monorepo", + "description": "a test repository", + "fork": false, + "url": "https://api.github.com/repos/xinyuluo/monorepo", + "forks_url": "https://api.github.com/repos/xinyuluo/monorepo/forks", + "keys_url": "https://api.github.com/repos/xinyuluo/monorepo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/xinyuluo/monorepo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/xinyuluo/monorepo/teams", + "hooks_url": "https://api.github.com/repos/xinyuluo/monorepo/hooks", + "issue_events_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/events{/number}", + "events_url": "https://api.github.com/repos/xinyuluo/monorepo/events", + "assignees_url": "https://api.github.com/repos/xinyuluo/monorepo/assignees{/user}", + "branches_url": "https://api.github.com/repos/xinyuluo/monorepo/branches{/branch}", + "tags_url": "https://api.github.com/repos/xinyuluo/monorepo/tags", + "blobs_url": "https://api.github.com/repos/xinyuluo/monorepo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/xinyuluo/monorepo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/xinyuluo/monorepo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/xinyuluo/monorepo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/xinyuluo/monorepo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/xinyuluo/monorepo/languages", + "stargazers_url": "https://api.github.com/repos/xinyuluo/monorepo/stargazers", + "contributors_url": "https://api.github.com/repos/xinyuluo/monorepo/contributors", + "subscribers_url": "https://api.github.com/repos/xinyuluo/monorepo/subscribers", + "subscription_url": "https://api.github.com/repos/xinyuluo/monorepo/subscription", + "commits_url": "https://api.github.com/repos/xinyuluo/monorepo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/xinyuluo/monorepo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/xinyuluo/monorepo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/xinyuluo/monorepo/contents/{+path}", + "compare_url": "https://api.github.com/repos/xinyuluo/monorepo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/xinyuluo/monorepo/merges", + "archive_url": "https://api.github.com/repos/xinyuluo/monorepo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/xinyuluo/monorepo/downloads", + "issues_url": "https://api.github.com/repos/xinyuluo/monorepo/issues{/number}", + "pulls_url": "https://api.github.com/repos/xinyuluo/monorepo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/xinyuluo/monorepo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/xinyuluo/monorepo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/xinyuluo/monorepo/labels{/name}", + "releases_url": "https://api.github.com/repos/xinyuluo/monorepo/releases{/id}", + "deployments_url": "https://api.github.com/repos/xinyuluo/monorepo/deployments", + "created_at": "2020-05-21T03:03:30Z", + "updated_at": "2020-05-21T03:36:41Z", + "pushed_at": "2020-05-21T05:53:34Z", + "git_url": "git://github.com/xinyuluo/monorepo.git", + "ssh_url": "git@github.com:xinyuluo/monorepo.git", + "clone_url": "https://github.com/xinyuluo/monorepo.git", + "svn_url": "https://github.com/xinyuluo/monorepo", + "homepage": "", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": "OCaml", + "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": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/xinyuluo/monorepo/pulls/4" + }, + "html": { + "href": "https://github.com/xinyuluo/monorepo/pull/4" + }, + "issue": { + "href": "https://api.github.com/repos/xinyuluo/monorepo/issues/4" + }, + "comments": { + "href": "https://api.github.com/repos/xinyuluo/monorepo/issues/4/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/xinyuluo/monorepo/pulls/4/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/xinyuluo/monorepo/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/xinyuluo/monorepo/pulls/4/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/xinyuluo/monorepo/statuses/cd92b75d1adfc5d5810445e3e3c4b019d4f7e3c0" + } + }, + "author_association": "OWNER", + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 1, + "deletions": 1, + "changed_files": 1 + }, + "label": { + "id": 0, + "node_id": "00000000000000000000", + "url": "https://api.github.com/repos/xinyuluo/monorepo/labels/backend", + "name": "backend", + "color": "c70ad8", + "default": false, + "description": "" + }, + "repository": { + "id": 0, + "node_id": "00000000000000000000", + "name": "monorepo", + "full_name": "xinyuluo/monorepo", + "private": true, + "owner": { + "login": "xinyuluo", + "id": 0, + "node_id": "00000000000000000000", + "avatar_url": "https://avatars0.githubusercontent.com/u/000000?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xinyuluo", + "html_url": "https://github.com/xinyuluo", + "followers_url": "https://api.github.com/users/xinyuluo/followers", + "following_url": "https://api.github.com/users/xinyuluo/following{/other_user}", + "gists_url": "https://api.github.com/users/xinyuluo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xinyuluo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xinyuluo/subscriptions", + "organizations_url": "https://api.github.com/users/xinyuluo/orgs", + "repos_url": "https://api.github.com/users/xinyuluo/repos", + "events_url": "https://api.github.com/users/xinyuluo/events{/privacy}", + "received_events_url": "https://api.github.com/users/xinyuluo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/xinyuluo/monorepo", + "description": "a test repository", + "fork": false, + "url": "https://api.github.com/repos/xinyuluo/monorepo", + "forks_url": "https://api.github.com/repos/xinyuluo/monorepo/forks", + "keys_url": "https://api.github.com/repos/xinyuluo/monorepo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/xinyuluo/monorepo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/xinyuluo/monorepo/teams", + "hooks_url": "https://api.github.com/repos/xinyuluo/monorepo/hooks", + "issue_events_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/events{/number}", + "events_url": "https://api.github.com/repos/xinyuluo/monorepo/events", + "assignees_url": "https://api.github.com/repos/xinyuluo/monorepo/assignees{/user}", + "branches_url": "https://api.github.com/repos/xinyuluo/monorepo/branches{/branch}", + "tags_url": "https://api.github.com/repos/xinyuluo/monorepo/tags", + "blobs_url": "https://api.github.com/repos/xinyuluo/monorepo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/xinyuluo/monorepo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/xinyuluo/monorepo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/xinyuluo/monorepo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/xinyuluo/monorepo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/xinyuluo/monorepo/languages", + "stargazers_url": "https://api.github.com/repos/xinyuluo/monorepo/stargazers", + "contributors_url": "https://api.github.com/repos/xinyuluo/monorepo/contributors", + "subscribers_url": "https://api.github.com/repos/xinyuluo/monorepo/subscribers", + "subscription_url": "https://api.github.com/repos/xinyuluo/monorepo/subscription", + "commits_url": "https://api.github.com/repos/xinyuluo/monorepo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/xinyuluo/monorepo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/xinyuluo/monorepo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/xinyuluo/monorepo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/xinyuluo/monorepo/contents/{+path}", + "compare_url": "https://api.github.com/repos/xinyuluo/monorepo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/xinyuluo/monorepo/merges", + "archive_url": "https://api.github.com/repos/xinyuluo/monorepo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/xinyuluo/monorepo/downloads", + "issues_url": "https://api.github.com/repos/xinyuluo/monorepo/issues{/number}", + "pulls_url": "https://api.github.com/repos/xinyuluo/monorepo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/xinyuluo/monorepo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/xinyuluo/monorepo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/xinyuluo/monorepo/labels{/name}", + "releases_url": "https://api.github.com/repos/xinyuluo/monorepo/releases{/id}", + "deployments_url": "https://api.github.com/repos/xinyuluo/monorepo/deployments", + "created_at": "2020-05-21T03:03:30Z", + "updated_at": "2020-05-21T03:36:41Z", + "pushed_at": "2020-05-21T05:53:34Z", + "git_url": "git://github.com/xinyuluo/monorepo.git", + "ssh_url": "git@github.com:xinyuluo/monorepo.git", + "clone_url": "https://github.com/xinyuluo/monorepo.git", + "svn_url": "https://github.com/xinyuluo/monorepo", + "homepage": "", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": "OCaml", + "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": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "xinyuluo", + "id": 0, + "node_id": "00000000000000000000", + "avatar_url": "https://avatars0.githubusercontent.com/u/000000?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/xinyuluo", + "html_url": "https://github.com/xinyuluo", + "followers_url": "https://api.github.com/users/xinyuluo/followers", + "following_url": "https://api.github.com/users/xinyuluo/following{/other_user}", + "gists_url": "https://api.github.com/users/xinyuluo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/xinyuluo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/xinyuluo/subscriptions", + "organizations_url": "https://api.github.com/users/xinyuluo/orgs", + "repos_url": "https://api.github.com/users/xinyuluo/repos", + "events_url": "https://api.github.com/users/xinyuluo/events{/privacy}", + "received_events_url": "https://api.github.com/users/xinyuluo/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/mock_payloads/pull_request_review_comment.created.json b/mock_payloads/pull_request_review_comment.created.json index acb36d36..9485836c 100644 --- a/mock_payloads/pull_request_review_comment.created.json +++ b/mock_payloads/pull_request_review_comment.created.json @@ -94,15 +94,9 @@ "merged_at": null, "merge_commit_sha": "3ca0f58f17dc9ac354a3b1b89f289ac16806e860", "assignee": null, - "assignees": [ - - ], - "requested_reviewers": [ - - ], - "requested_teams": [ - - ], + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], "labels": [ { "id": 0, diff --git a/mock_states/pull_request.labeled_two_labels_with_thread.json b/mock_states/pull_request.labeled_two_labels_with_thread.json new file mode 100644 index 00000000..977c919e --- /dev/null +++ b/mock_states/pull_request.labeled_two_labels_with_thread.json @@ -0,0 +1,18 @@ +{ + "pipeline_statuses": {}, + "pipeline_commits": {}, + "slack_threads": { + "https://github.com/xinyuluo/monorepo/pull/4": [ + { + "channel": "a1-bot", + "ts": "1728399554.482879", + "cid": "Ca1bot" + }, + { + "channel": "backend", + "ts": "1728399554.444444", + "cid": "Cbackend" + } + ] + } +} diff --git a/mock_states/pull_request_review.approved.json b/mock_states/pull_request_review.approved.json new file mode 100644 index 00000000..279065b8 --- /dev/null +++ b/mock_states/pull_request_review.approved.json @@ -0,0 +1,13 @@ +{ + "pipeline_statuses": {}, + "pipeline_commits": {}, + "slack_threads": { + "https://github.com/Khady/monorepo/pull/6": [ + { + "channel": "default", + "ts": "1728399554.482879", + "cid": "Cdefault" + } + ] + } +} diff --git a/mock_states/pull_request_review.commented.json b/mock_states/pull_request_review.commented.json new file mode 100644 index 00000000..513a8cf1 --- /dev/null +++ b/mock_states/pull_request_review.commented.json @@ -0,0 +1,13 @@ +{ + "pipeline_statuses": {}, + "pipeline_commits": {}, + "slack_threads": { + "https://github.com/xinyuluo/monorepo/pull/3": [ + { + "channel": "frontend-bot", + "ts": "1728399554.482879", + "cid": "Cfebot" + } + ] + } +} diff --git a/mock_states/pull_request_review.request_changes.json b/mock_states/pull_request_review.request_changes.json new file mode 100644 index 00000000..279065b8 --- /dev/null +++ b/mock_states/pull_request_review.request_changes.json @@ -0,0 +1,13 @@ +{ + "pipeline_statuses": {}, + "pipeline_commits": {}, + "slack_threads": { + "https://github.com/Khady/monorepo/pull/6": [ + { + "channel": "default", + "ts": "1728399554.482879", + "cid": "Cdefault" + } + ] + } +} diff --git a/mock_states/pull_request_review.submitted_comment.json b/mock_states/pull_request_review.submitted_comment.json new file mode 100644 index 00000000..513a8cf1 --- /dev/null +++ b/mock_states/pull_request_review.submitted_comment.json @@ -0,0 +1,13 @@ +{ + "pipeline_statuses": {}, + "pipeline_commits": {}, + "slack_threads": { + "https://github.com/xinyuluo/monorepo/pull/3": [ + { + "channel": "frontend-bot", + "ts": "1728399554.482879", + "cid": "Cfebot" + } + ] + } +} diff --git a/mock_states/pull_request_review_comment.created.json b/mock_states/pull_request_review_comment.created.json new file mode 100644 index 00000000..977c919e --- /dev/null +++ b/mock_states/pull_request_review_comment.created.json @@ -0,0 +1,18 @@ +{ + "pipeline_statuses": {}, + "pipeline_commits": {}, + "slack_threads": { + "https://github.com/xinyuluo/monorepo/pull/4": [ + { + "channel": "a1-bot", + "ts": "1728399554.482879", + "cid": "Ca1bot" + }, + { + "channel": "backend", + "ts": "1728399554.444444", + "cid": "Cbackend" + } + ] + } +} diff --git a/mock_states/status.commit1-02-failed.json b/mock_states/status.commit1-02-failed.json index 48e41154..fe673357 100644 --- a/mock_states/status.commit1-02-failed.json +++ b/mock_states/status.commit1-02-failed.json @@ -21,5 +21,6 @@ "s1": ["7e0a933e9c71b4ca107680ca958ca1888d5e479b"], "s2": [] } - } + }, + "slack_threads": {} } diff --git a/mock_states/status.state_hide_success_test.json b/mock_states/status.state_hide_success_test.json index f53e0857..b141aa26 100644 --- a/mock_states/status.state_hide_success_test.json +++ b/mock_states/status.state_hide_success_test.json @@ -21,5 +21,6 @@ } } }, - "pipeline_commits": {} + "pipeline_commits": {}, + "slack_threads": {} } diff --git a/mock_states/status.state_hide_success_test_disallowed_pipeline.json b/mock_states/status.state_hide_success_test_disallowed_pipeline.json index 3438bf7e..41fbb975 100644 --- a/mock_states/status.state_hide_success_test_disallowed_pipeline.json +++ b/mock_states/status.state_hide_success_test_disallowed_pipeline.json @@ -16,5 +16,6 @@ } } }, - "pipeline_commits": {} + "pipeline_commits": {}, + "slack_threads": {} } diff --git a/test/slack_payloads.expected b/test/slack_payloads.expected index ec1c7cbe..5a3cf175 100644 --- a/test/slack_payloads.expected +++ b/test/slack_payloads.expected @@ -230,7 +230,7 @@ will notify #backend "fallback": null, "mrkdwn_in": [ "text" ], "color": "#ccc", - "text": "Labels: backend" + "text": "*Labels*: _backend_" } ], "unfurl_links": false @@ -286,17 +286,19 @@ will notify #default "text": " Pull request #2 merged by *xinyuluo*", "unfurl_links": false } -===== file ../mock_payloads/pull_request.labeled_two_labels.json ===== +===== file ../mock_payloads/pull_request.labeled_two_labels_no_thread.json ===== +===== file ../mock_payloads/pull_request.labeled_two_labels_with_thread.json ===== will notify #a1-bot { "channel": "a1-bot", + "thread_ts": "1728399554.482879", "text": " Pull request #4 labeled by *xinyuluo*", "attachments": [ { "fallback": null, "mrkdwn_in": [ "text" ], "color": "#ccc", - "text": "Labels: a1, backend" + "text": "*Labels*: _a1_, _backend_" } ], "unfurl_links": false @@ -304,13 +306,14 @@ will notify #a1-bot will notify #backend { "channel": "backend", + "thread_ts": "1728399554.444444", "text": " Pull request #4 labeled by *xinyuluo*", "attachments": [ { "fallback": null, "mrkdwn_in": [ "text" ], "color": "#ccc", - "text": "Labels: a1, backend" + "text": "*Labels*: _a1_, _backend_" } ], "unfurl_links": false @@ -325,7 +328,7 @@ will notify #frontend-bot "fallback": null, "mrkdwn_in": [ "text" ], "color": "#ccc", - "text": "" + "text": "*Labels*: _enhancement_" } ], "unfurl_links": false @@ -351,6 +354,21 @@ will notify #default { "channel": "default", "text": " *Khady* #6 ", + "attachments": [ + { + "fallback": null, + "mrkdwn_in": [ "text" ], + "color": "#ccc", + "text": "*Comment*: approve review" + } + ], + "unfurl_links": false +} +will notify #default +{ + "channel": "default", + "thread_ts": "1728399554.482879", + "text": " *Khady* #6 ", "attachments": [ { "fallback": null, @@ -365,7 +383,22 @@ will notify #default will notify #frontend-bot { "channel": "frontend-bot", - "text": " *xinyuluo* #3 ", + "text": " *xinyuluo* #3 ", + "attachments": [ + { + "fallback": null, + "mrkdwn_in": [ "text" ], + "color": "#ccc", + "text": "*Comment*: submit a PR review" + } + ], + "unfurl_links": false +} +will notify #frontend-bot +{ + "channel": "frontend-bot", + "thread_ts": "1728399554.482879", + "text": " *xinyuluo* #3 ", "attachments": [ { "fallback": null, @@ -383,6 +416,21 @@ will notify #default { "channel": "default", "text": " *Khady* #6 ", + "attachments": [ + { + "fallback": null, + "mrkdwn_in": [ "text" ], + "color": "#ccc", + "text": "*Comment*: request changes review" + } + ], + "unfurl_links": false +} +will notify #default +{ + "channel": "default", + "thread_ts": "1728399554.482879", + "text": " *Khady* #6 ", "attachments": [ { "fallback": null, @@ -397,7 +445,22 @@ will notify #default will notify #frontend-bot { "channel": "frontend-bot", - "text": " *xinyuluo* #3 ", + "text": " *xinyuluo* #3 ", + "attachments": [ + { + "fallback": null, + "mrkdwn_in": [ "text" ], + "color": "#ccc", + "text": "*Comment*: This is a great PR, thank you!" + } + ], + "unfurl_links": false +} +will notify #frontend-bot +{ + "channel": "frontend-bot", + "thread_ts": "1728399554.482879", + "text": " *xinyuluo* #3 ", "attachments": [ { "fallback": null, @@ -411,6 +474,38 @@ will notify #frontend-bot ===== file ../mock_payloads/pull_request_review.submitted_no_comment.json ===== ===== file ../mock_payloads/pull_request_review.submitted_null_body.json ===== ===== file ../mock_payloads/pull_request_review_comment.created.json ===== +will notify #a1-bot +{ + "channel": "a1-bot", + "thread_ts": "1728399554.482879", + "text": " *xinyuluo* commented on #4 ", + "attachments": [ + { + "fallback": null, + "mrkdwn_in": [ "text" ], + "color": "#ccc", + "text": "PR review comment example", + "footer": "Commented in file " + } + ], + "unfurl_links": false +} +will notify #backend +{ + "channel": "backend", + "thread_ts": "1728399554.444444", + "text": " *xinyuluo* commented on #4 ", + "attachments": [ + { + "fallback": null, + "mrkdwn_in": [ "text" ], + "color": "#ccc", + "text": "PR review comment example", + "footer": "Commented in file " + } + ], + "unfurl_links": false +} ===== file ../mock_payloads/pull_request_review_comment.deleted.json ===== ===== file ../mock_payloads/pull_request_review_comment.edited.json ===== ===== file ../mock_payloads/push.branch_filter_default.json =====