diff --git a/src/index.ts b/src/index.ts index 3e0a819..12bb879 100644 --- a/src/index.ts +++ b/src/index.ts @@ -43,7 +43,9 @@ export = (app: Probot) => { const shouldReviewReadyAPIPR = action === 'ready_for_review' && pr.labels.some(({ id }) => hasAPILabel(id)); - if (shouldReviewReadyAPIPR || shouldReviewNewAPIPR) { + const isDecember = new Date(payload.pull_request.updated_at).getMonth() === 11; + + if (!isDecember && (shouldReviewReadyAPIPR || shouldReviewNewAPIPR)) { await postToSlack(pr); } }); diff --git a/test/fixtures/pull_request.labeled.december.json b/test/fixtures/pull_request.labeled.december.json new file mode 100644 index 0000000..0a1fdf6 --- /dev/null +++ b/test/fixtures/pull_request.labeled.december.json @@ -0,0 +1,690 @@ +{ + "action": "labeled", + "number": 38982, + "pull_request": { + "url": "https://api.github.com/repos/electron/electron/pulls/38982", + "id": 1419246452, + "node_id": "PR_kwDOAI8xS85Ul_t0", + "html_url": "https://github.com/electron/electron/pull/38982", + "diff_url": "https://github.com/electron/electron/pull/38982.diff", + "patch_url": "https://github.com/electron/electron/pull/38982.patch", + "issue_url": "https://api.github.com/repos/electron/electron/issues/38982", + "number": 38982, + "state": "open", + "locked": false, + "title": "feat: add `BrowserWindow.isOccluded()`", + "user": { + "login": "codebytere", + "id": 2036040, + "node_id": "MDQ6VXNlcjIwMzYwNDA=", + "avatar_url": "https://avatars.githubusercontent.com/u/2036040?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/codebytere", + "html_url": "https://github.com/codebytere", + "followers_url": "https://api.github.com/users/codebytere/followers", + "following_url": "https://api.github.com/users/codebytere/following{/other_user}", + "gists_url": "https://api.github.com/users/codebytere/gists{/gist_id}", + "starred_url": "https://api.github.com/users/codebytere/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/codebytere/subscriptions", + "organizations_url": "https://api.github.com/users/codebytere/orgs", + "repos_url": "https://api.github.com/users/codebytere/repos", + "events_url": "https://api.github.com/users/codebytere/events{/privacy}", + "received_events_url": "https://api.github.com/users/codebytere/received_events", + "type": "User", + "site_admin": false + }, + "body": "#### Description of Change\r\n\r\nCloses https://github.com/electron/electron/issues/38955.\r\n\r\nWe've historically not been consistent in our implementations of `BrowserWindow.isVisible()` and similar methods how occlusion affects return values. I believe instead it might be more effective to add in a separate method for apps to check occlusion status.\r\n\r\nThis also removes the occlusion check from the macOS implementation of `BrowserWindow.isVisible()`, which was broken and not being properly accounted for.\r\n\r\n#### Checklist\r\n\r\n\r\n- [x] PR description included and stakeholders cc'd\r\n- [x] `npm test` passes\r\n- [x] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)\r\n- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).\r\n\r\n#### Release Notes\r\n\r\nNotes: Added a new method `BrowserWindow.isOccluded()` to allow apps to check occlusion status.", + "created_at": "2023-12-04T08:52:02Z", + "updated_at": "2023-12-24T12:33:31Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "eb1a1aded93c9ef04ac81e7bfda6277db73212a7", + "assignee": null, + "assignees": [], + "requested_reviewers": [ + { + "login": "jkleinsc", + "id": 609052, + "node_id": "MDQ6VXNlcjYwOTA1Mg==", + "avatar_url": "https://avatars.githubusercontent.com/u/609052?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jkleinsc", + "html_url": "https://github.com/jkleinsc", + "followers_url": "https://api.github.com/users/jkleinsc/followers", + "following_url": "https://api.github.com/users/jkleinsc/following{/other_user}", + "gists_url": "https://api.github.com/users/jkleinsc/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jkleinsc/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jkleinsc/subscriptions", + "organizations_url": "https://api.github.com/users/jkleinsc/orgs", + "repos_url": "https://api.github.com/users/jkleinsc/repos", + "events_url": "https://api.github.com/users/jkleinsc/events{/privacy}", + "received_events_url": "https://api.github.com/users/jkleinsc/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "zcbenz", + "id": 639601, + "node_id": "MDQ6VXNlcjYzOTYwMQ==", + "avatar_url": "https://avatars.githubusercontent.com/u/639601?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/zcbenz", + "html_url": "https://github.com/zcbenz", + "followers_url": "https://api.github.com/users/zcbenz/followers", + "following_url": "https://api.github.com/users/zcbenz/following{/other_user}", + "gists_url": "https://api.github.com/users/zcbenz/gists{/gist_id}", + "starred_url": "https://api.github.com/users/zcbenz/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/zcbenz/subscriptions", + "organizations_url": "https://api.github.com/users/zcbenz/orgs", + "repos_url": "https://api.github.com/users/zcbenz/repos", + "events_url": "https://api.github.com/users/zcbenz/events{/privacy}", + "received_events_url": "https://api.github.com/users/zcbenz/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "miniak", + "id": 1281234, + "node_id": "MDQ6VXNlcjEyODEyMzQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/1281234?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/miniak", + "html_url": "https://github.com/miniak", + "followers_url": "https://api.github.com/users/miniak/followers", + "following_url": "https://api.github.com/users/miniak/following{/other_user}", + "gists_url": "https://api.github.com/users/miniak/gists{/gist_id}", + "starred_url": "https://api.github.com/users/miniak/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/miniak/subscriptions", + "organizations_url": "https://api.github.com/users/miniak/orgs", + "repos_url": "https://api.github.com/users/miniak/repos", + "events_url": "https://api.github.com/users/miniak/events{/privacy}", + "received_events_url": "https://api.github.com/users/miniak/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "VerteDinde", + "id": 4624411, + "node_id": "MDQ6VXNlcjQ2MjQ0MTE=", + "avatar_url": "https://avatars.githubusercontent.com/u/4624411?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/VerteDinde", + "html_url": "https://github.com/VerteDinde", + "followers_url": "https://api.github.com/users/VerteDinde/followers", + "following_url": "https://api.github.com/users/VerteDinde/following{/other_user}", + "gists_url": "https://api.github.com/users/VerteDinde/gists{/gist_id}", + "starred_url": "https://api.github.com/users/VerteDinde/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/VerteDinde/subscriptions", + "organizations_url": "https://api.github.com/users/VerteDinde/orgs", + "repos_url": "https://api.github.com/users/VerteDinde/repos", + "events_url": "https://api.github.com/users/VerteDinde/events{/privacy}", + "received_events_url": "https://api.github.com/users/VerteDinde/received_events", + "type": "User", + "site_admin": false + } + ], + "requested_teams": [], + "labels": [ + { + "id": 1034512799, + "node_id": "MDU6TGFiZWwxMDM0NTEyNzk5", + "url": "https://api.github.com/repos/electron/electron/labels/semver/patch", + "name": "semver/patch", + "color": "6ac2dd", + "default": false, + "description": "backwards-compatible bug fixes" + }, + { + "id": 1243058793, + "node_id": "MDU6TGFiZWwxMjQzMDU4Nzkz", + "url": "https://api.github.com/repos/electron/electron/labels/new-pr%20%F0%9F%8C%B1", + "name": "new-pr 🌱", + "color": "8af297", + "default": false, + "description": "PR opened in the last 24 hours" + }, + { + "id": 5135796091, + "node_id": "LA_kwDOAI8xS88AAAABMh4Hew", + "url": "https://api.github.com/repos/electron/electron/labels/target/24-x-y", + "name": "target/24-x-y", + "color": "ad244f", + "default": false, + "description": "PR should also be added to the \"24-x-y\" branch." + }, + { + "id": 5358528181, + "node_id": "LA_kwDOAI8xS88AAAABP2SmtQ", + "url": "https://api.github.com/repos/electron/electron/labels/target/25-x-y", + "name": "target/25-x-y", + "color": "ad244f", + "default": false, + "description": "PR should also be added to the \"25-x-y\" branch." + }, + { + "id": 5566791473, + "node_id": "LA_kwDOAI8xS88AAAABS85_MQ", + "url": "https://api.github.com/repos/electron/electron/labels/target/26-x-y", + "name": "target/26-x-y", + "color": "ad244f", + "default": false, + "description": "PR should also be added to the \"26-x-y\" branch." + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/electron/electron/pulls/38982/commits", + "review_comments_url": "https://api.github.com/repos/electron/electron/pulls/38982/comments", + "review_comment_url": "https://api.github.com/repos/electron/electron/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/electron/electron/issues/38982/comments", + "statuses_url": "https://api.github.com/repos/electron/electron/statuses/759f1e84af46b7feddf973be4b63ae29ff98a7bf", + "head": { + "label": "electron:fix-is-visible-check", + "ref": "fix-is-visible-check", + "sha": "759f1e84af46b7feddf973be4b63ae29ff98a7bf", + "user": { + "login": "electron", + "id": 13409222, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEzNDA5MjIy", + "avatar_url": "https://avatars.githubusercontent.com/u/13409222?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/electron", + "html_url": "https://github.com/electron", + "followers_url": "https://api.github.com/users/electron/followers", + "following_url": "https://api.github.com/users/electron/following{/other_user}", + "gists_url": "https://api.github.com/users/electron/gists{/gist_id}", + "starred_url": "https://api.github.com/users/electron/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/electron/subscriptions", + "organizations_url": "https://api.github.com/users/electron/orgs", + "repos_url": "https://api.github.com/users/electron/repos", + "events_url": "https://api.github.com/users/electron/events{/privacy}", + "received_events_url": "https://api.github.com/users/electron/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 9384267, + "node_id": "MDEwOlJlcG9zaXRvcnk5Mzg0MjY3", + "name": "electron", + "full_name": "electron/electron", + "private": false, + "owner": { + "login": "electron", + "id": 13409222, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEzNDA5MjIy", + "avatar_url": "https://avatars.githubusercontent.com/u/13409222?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/electron", + "html_url": "https://github.com/electron", + "followers_url": "https://api.github.com/users/electron/followers", + "following_url": "https://api.github.com/users/electron/following{/other_user}", + "gists_url": "https://api.github.com/users/electron/gists{/gist_id}", + "starred_url": "https://api.github.com/users/electron/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/electron/subscriptions", + "organizations_url": "https://api.github.com/users/electron/orgs", + "repos_url": "https://api.github.com/users/electron/repos", + "events_url": "https://api.github.com/users/electron/events{/privacy}", + "received_events_url": "https://api.github.com/users/electron/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/electron/electron", + "description": ":electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS", + "fork": false, + "url": "https://api.github.com/repos/electron/electron", + "forks_url": "https://api.github.com/repos/electron/electron/forks", + "keys_url": "https://api.github.com/repos/electron/electron/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/electron/electron/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/electron/electron/teams", + "hooks_url": "https://api.github.com/repos/electron/electron/hooks", + "issue_events_url": "https://api.github.com/repos/electron/electron/issues/events{/number}", + "events_url": "https://api.github.com/repos/electron/electron/events", + "assignees_url": "https://api.github.com/repos/electron/electron/assignees{/user}", + "branches_url": "https://api.github.com/repos/electron/electron/branches{/branch}", + "tags_url": "https://api.github.com/repos/electron/electron/tags", + "blobs_url": "https://api.github.com/repos/electron/electron/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/electron/electron/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/electron/electron/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/electron/electron/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/electron/electron/statuses/{sha}", + "languages_url": "https://api.github.com/repos/electron/electron/languages", + "stargazers_url": "https://api.github.com/repos/electron/electron/stargazers", + "contributors_url": "https://api.github.com/repos/electron/electron/contributors", + "subscribers_url": "https://api.github.com/repos/electron/electron/subscribers", + "subscription_url": "https://api.github.com/repos/electron/electron/subscription", + "commits_url": "https://api.github.com/repos/electron/electron/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/electron/electron/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/electron/electron/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/electron/electron/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/electron/electron/contents/{+path}", + "compare_url": "https://api.github.com/repos/electron/electron/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/electron/electron/merges", + "archive_url": "https://api.github.com/repos/electron/electron/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/electron/electron/downloads", + "issues_url": "https://api.github.com/repos/electron/electron/issues{/number}", + "pulls_url": "https://api.github.com/repos/electron/electron/pulls{/number}", + "milestones_url": "https://api.github.com/repos/electron/electron/milestones{/number}", + "notifications_url": "https://api.github.com/repos/electron/electron/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/electron/electron/labels{/name}", + "releases_url": "https://api.github.com/repos/electron/electron/releases{/id}", + "deployments_url": "https://api.github.com/repos/electron/electron/deployments", + "created_at": "2013-04-12T01:47:36Z", + "updated_at": "2023-12-24T11:44:05Z", + "pushed_at": "2023-07-24T12:32:11Z", + "git_url": "git://github.com/electron/electron.git", + "ssh_url": "git@github.com:electron/electron.git", + "clone_url": "https://github.com/electron/electron.git", + "svn_url": "https://github.com/electron/electron", + "homepage": "https://electronjs.org", + "size": 133983, + "stargazers_count": 108314, + "watchers_count": 108314, + "language": "C++", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 14855, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 926, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "c-plus-plus", + "chrome", + "css", + "electron", + "html", + "javascript", + "nodejs", + "v8", + "works-with-codespaces" + ], + "visibility": "public", + "forks": 14855, + "open_issues": 926, + "watchers": 108314, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": false, + "use_squash_pr_title_as_default": true, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "electron:main", + "ref": "main", + "sha": "09e6e4b9a7862416e1ac8e45d94c17b015a80165", + "user": { + "login": "electron", + "id": 13409222, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEzNDA5MjIy", + "avatar_url": "https://avatars.githubusercontent.com/u/13409222?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/electron", + "html_url": "https://github.com/electron", + "followers_url": "https://api.github.com/users/electron/followers", + "following_url": "https://api.github.com/users/electron/following{/other_user}", + "gists_url": "https://api.github.com/users/electron/gists{/gist_id}", + "starred_url": "https://api.github.com/users/electron/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/electron/subscriptions", + "organizations_url": "https://api.github.com/users/electron/orgs", + "repos_url": "https://api.github.com/users/electron/repos", + "events_url": "https://api.github.com/users/electron/events{/privacy}", + "received_events_url": "https://api.github.com/users/electron/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 9384267, + "node_id": "MDEwOlJlcG9zaXRvcnk5Mzg0MjY3", + "name": "electron", + "full_name": "electron/electron", + "private": false, + "owner": { + "login": "electron", + "id": 13409222, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEzNDA5MjIy", + "avatar_url": "https://avatars.githubusercontent.com/u/13409222?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/electron", + "html_url": "https://github.com/electron", + "followers_url": "https://api.github.com/users/electron/followers", + "following_url": "https://api.github.com/users/electron/following{/other_user}", + "gists_url": "https://api.github.com/users/electron/gists{/gist_id}", + "starred_url": "https://api.github.com/users/electron/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/electron/subscriptions", + "organizations_url": "https://api.github.com/users/electron/orgs", + "repos_url": "https://api.github.com/users/electron/repos", + "events_url": "https://api.github.com/users/electron/events{/privacy}", + "received_events_url": "https://api.github.com/users/electron/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/electron/electron", + "description": ":electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS", + "fork": false, + "url": "https://api.github.com/repos/electron/electron", + "forks_url": "https://api.github.com/repos/electron/electron/forks", + "keys_url": "https://api.github.com/repos/electron/electron/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/electron/electron/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/electron/electron/teams", + "hooks_url": "https://api.github.com/repos/electron/electron/hooks", + "issue_events_url": "https://api.github.com/repos/electron/electron/issues/events{/number}", + "events_url": "https://api.github.com/repos/electron/electron/events", + "assignees_url": "https://api.github.com/repos/electron/electron/assignees{/user}", + "branches_url": "https://api.github.com/repos/electron/electron/branches{/branch}", + "tags_url": "https://api.github.com/repos/electron/electron/tags", + "blobs_url": "https://api.github.com/repos/electron/electron/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/electron/electron/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/electron/electron/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/electron/electron/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/electron/electron/statuses/{sha}", + "languages_url": "https://api.github.com/repos/electron/electron/languages", + "stargazers_url": "https://api.github.com/repos/electron/electron/stargazers", + "contributors_url": "https://api.github.com/repos/electron/electron/contributors", + "subscribers_url": "https://api.github.com/repos/electron/electron/subscribers", + "subscription_url": "https://api.github.com/repos/electron/electron/subscription", + "commits_url": "https://api.github.com/repos/electron/electron/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/electron/electron/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/electron/electron/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/electron/electron/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/electron/electron/contents/{+path}", + "compare_url": "https://api.github.com/repos/electron/electron/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/electron/electron/merges", + "archive_url": "https://api.github.com/repos/electron/electron/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/electron/electron/downloads", + "issues_url": "https://api.github.com/repos/electron/electron/issues{/number}", + "pulls_url": "https://api.github.com/repos/electron/electron/pulls{/number}", + "milestones_url": "https://api.github.com/repos/electron/electron/milestones{/number}", + "notifications_url": "https://api.github.com/repos/electron/electron/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/electron/electron/labels{/name}", + "releases_url": "https://api.github.com/repos/electron/electron/releases{/id}", + "deployments_url": "https://api.github.com/repos/electron/electron/deployments", + "created_at": "2013-04-12T01:47:36Z", + "updated_at": "2023-12-24T11:44:05Z", + "pushed_at": "2023-07-24T12:32:11Z", + "git_url": "git://github.com/electron/electron.git", + "ssh_url": "git@github.com:electron/electron.git", + "clone_url": "https://github.com/electron/electron.git", + "svn_url": "https://github.com/electron/electron", + "homepage": "https://electronjs.org", + "size": 133983, + "stargazers_count": 108314, + "watchers_count": 108314, + "language": "C++", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 14855, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 926, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "c-plus-plus", + "chrome", + "css", + "electron", + "html", + "javascript", + "nodejs", + "v8", + "works-with-codespaces" + ], + "visibility": "public", + "forks": 14855, + "open_issues": 926, + "watchers": 108314, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": false, + "use_squash_pr_title_as_default": true, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/electron/electron/pulls/38982" + }, + "html": { + "href": "https://github.com/electron/electron/pull/38982" + }, + "issue": { + "href": "https://api.github.com/repos/electron/electron/issues/38982" + }, + "comments": { + "href": "https://api.github.com/repos/electron/electron/issues/38982/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/electron/electron/pulls/38982/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/electron/electron/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/electron/electron/pulls/38982/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/electron/electron/statuses/759f1e84af46b7feddf973be4b63ae29ff98a7bf" + } + }, + "author_association": "MEMBER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 20, + "deletions": 2, + "changed_files": 6 + }, + "label": { + "id": 1603621692, + "node_id": "MDU6TGFiZWwxNjAzNjIxNjky", + "url": "https://api.github.com/repos/electron/electron/labels/api-review/requested%20%F0%9F%97%B3", + "name": "api-review/requested 🗳", + "color": "c918ba", + "default": false, + "description": "" + }, + "repository": { + "id": 9384267, + "node_id": "MDEwOlJlcG9zaXRvcnk5Mzg0MjY3", + "name": "electron", + "full_name": "electron/electron", + "private": false, + "owner": { + "login": "electron", + "id": 13409222, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEzNDA5MjIy", + "avatar_url": "https://avatars.githubusercontent.com/u/13409222?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/electron", + "html_url": "https://github.com/electron", + "followers_url": "https://api.github.com/users/electron/followers", + "following_url": "https://api.github.com/users/electron/following{/other_user}", + "gists_url": "https://api.github.com/users/electron/gists{/gist_id}", + "starred_url": "https://api.github.com/users/electron/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/electron/subscriptions", + "organizations_url": "https://api.github.com/users/electron/orgs", + "repos_url": "https://api.github.com/users/electron/repos", + "events_url": "https://api.github.com/users/electron/events{/privacy}", + "received_events_url": "https://api.github.com/users/electron/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/electron/electron", + "description": ":electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS", + "fork": false, + "url": "https://api.github.com/repos/electron/electron", + "forks_url": "https://api.github.com/repos/electron/electron/forks", + "keys_url": "https://api.github.com/repos/electron/electron/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/electron/electron/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/electron/electron/teams", + "hooks_url": "https://api.github.com/repos/electron/electron/hooks", + "issue_events_url": "https://api.github.com/repos/electron/electron/issues/events{/number}", + "events_url": "https://api.github.com/repos/electron/electron/events", + "assignees_url": "https://api.github.com/repos/electron/electron/assignees{/user}", + "branches_url": "https://api.github.com/repos/electron/electron/branches{/branch}", + "tags_url": "https://api.github.com/repos/electron/electron/tags", + "blobs_url": "https://api.github.com/repos/electron/electron/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/electron/electron/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/electron/electron/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/electron/electron/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/electron/electron/statuses/{sha}", + "languages_url": "https://api.github.com/repos/electron/electron/languages", + "stargazers_url": "https://api.github.com/repos/electron/electron/stargazers", + "contributors_url": "https://api.github.com/repos/electron/electron/contributors", + "subscribers_url": "https://api.github.com/repos/electron/electron/subscribers", + "subscription_url": "https://api.github.com/repos/electron/electron/subscription", + "commits_url": "https://api.github.com/repos/electron/electron/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/electron/electron/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/electron/electron/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/electron/electron/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/electron/electron/contents/{+path}", + "compare_url": "https://api.github.com/repos/electron/electron/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/electron/electron/merges", + "archive_url": "https://api.github.com/repos/electron/electron/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/electron/electron/downloads", + "issues_url": "https://api.github.com/repos/electron/electron/issues{/number}", + "pulls_url": "https://api.github.com/repos/electron/electron/pulls{/number}", + "milestones_url": "https://api.github.com/repos/electron/electron/milestones{/number}", + "notifications_url": "https://api.github.com/repos/electron/electron/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/electron/electron/labels{/name}", + "releases_url": "https://api.github.com/repos/electron/electron/releases{/id}", + "deployments_url": "https://api.github.com/repos/electron/electron/deployments", + "created_at": "2013-04-12T01:47:36Z", + "updated_at": "2023-12-24T11:44:05Z", + "pushed_at": "2023-07-24T12:32:11Z", + "git_url": "git://github.com/electron/electron.git", + "ssh_url": "git@github.com:electron/electron.git", + "clone_url": "https://github.com/electron/electron.git", + "svn_url": "https://github.com/electron/electron", + "homepage": "https://electronjs.org", + "size": 133983, + "stargazers_count": 108314, + "watchers_count": 108314, + "language": "C++", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 14855, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 926, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "c-plus-plus", + "chrome", + "css", + "electron", + "html", + "javascript", + "nodejs", + "v8", + "works-with-codespaces" + ], + "visibility": "public", + "forks": 14855, + "open_issues": 926, + "watchers": 108314, + "default_branch": "main" + }, + "organization": { + "login": "electron", + "id": 13409222, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjEzNDA5MjIy", + "url": "https://api.github.com/orgs/electron", + "repos_url": "https://api.github.com/orgs/electron/repos", + "events_url": "https://api.github.com/orgs/electron/events", + "hooks_url": "https://api.github.com/orgs/electron/hooks", + "issues_url": "https://api.github.com/orgs/electron/issues", + "members_url": "https://api.github.com/orgs/electron/members{/member}", + "public_members_url": "https://api.github.com/orgs/electron/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/13409222?v=4", + "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS" + }, + "sender": { + "login": "electron-cation[bot]", + "id": 47864737, + "node_id": "MDM6Qm90NDc4NjQ3Mzc=", + "avatar_url": "https://avatars.githubusercontent.com/in/25811?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/electron-cation%5Bbot%5D", + "html_url": "https://github.com/apps/electron-cation", + "followers_url": "https://api.github.com/users/electron-cation%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/electron-cation%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/electron-cation%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/electron-cation%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/electron-cation%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/electron-cation%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/electron-cation%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/electron-cation%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/electron-cation%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "installation": { + "id": 18942820, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMTg5NDI4MjA=" + } +} diff --git a/test/index.test.ts b/test/index.test.ts index 1e11d19..b81044b 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -58,4 +58,12 @@ describe('New PR Slack Notifications', () => { expect(client.chat.postMessage).toHaveBeenCalled(); }); + + it('does not post to Slack in the month of December', async () => { + const payload = require('./fixtures/pull_request.labeled.december.json'); + + await probot.receive({ name: 'pull_request', payload, id: 'abc123' }); + + expect(client.chat.postMessage).not.toHaveBeenCalled(); + }); });