From 87f3608acc6ef9c092234606b46573fb37989d68 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Tue, 8 Aug 2023 04:58:28 -0700 Subject: [PATCH 1/3] feat: deprecation review --- README.md | 14 +- spec/deprecation-review-state.spec.ts | 411 ++++++++++++++ .../issue_comment.checklist_complete.json | 240 +++++++++ .../issue_comment.edited.json | 240 +++++++++ .../pull_request.no_review_label.json | 488 +++++++++++++++++ .../pull_request.requested_review_label.json | 507 ++++++++++++++++++ .../pull_request.review_complete_label.json | 376 +++++++++++++ .../pull_request.unlabeled.json | 497 +++++++++++++++++ src/constants.ts | 7 + src/deprecation-checklist.md | 21 + src/deprecation-review-state.ts | 293 ++++++++++ src/index.ts | 2 + 12 files changed, 3094 insertions(+), 2 deletions(-) create mode 100644 spec/deprecation-review-state.spec.ts create mode 100644 spec/fixtures/deprecation-review-state/issue_comment.checklist_complete.json create mode 100644 spec/fixtures/deprecation-review-state/issue_comment.edited.json create mode 100644 spec/fixtures/deprecation-review-state/pull_request.no_review_label.json create mode 100644 spec/fixtures/deprecation-review-state/pull_request.requested_review_label.json create mode 100644 spec/fixtures/deprecation-review-state/pull_request.review_complete_label.json create mode 100644 spec/fixtures/deprecation-review-state/pull_request.unlabeled.json create mode 100644 src/deprecation-checklist.md create mode 100644 src/deprecation-review-state.ts diff --git a/README.md b/README.md index f92c222..1e41165 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Test](https://github.com/electron/cation/actions/workflows/test.yml/badge.svg)](https://github.com/electron/cation/actions/workflows/test.yml) -`cation` is Electron's PR monitoring bot, which serves three primary functions - semver label enforcement, PR open time enforcement, and API review bookkeeping. Each of the three are discussed in further detail below. +`cation` is Electron's PR monitoring bot, which serves four primary functions - semver label enforcement, PR open time enforcement, API review bookkeeping, and deprecation review. Each of the four are discussed in further detail below. ## Semver Label @@ -30,7 +30,7 @@ Backport PRs (PRs to a release branch that is not `main`) do not require a minim ## API Review -The final function of this bot is to control the API review lifecycle on behalf of the [API Working Group](https://github.com/electron/governance/tree/main/wg-api). +The bot controls the API review lifecycle on behalf of the [API Working Group](https://github.com/electron/governance/tree/main/wg-api). This group's review is mandated on all API changes, and their goal is twofold: 1. To guide Electron’s API surface towards a more ergonomic and usable design. @@ -47,3 +47,13 @@ Members of the API Working Group must indicate their approval by leaving a comme Screen Shot 2021-11-02 at 10 49 27 AM If a PR has passed its minimum open time and has the requisite number of approvals with no outstanding requests for changes, the bot will then switch `api-review/requested 🗳` to `api-review/approved ✅`, and the PR is free to be merged. If outstanding change requests persist, then the group will initiate consensus-seeking procedures and ultimately choose to approve or decline the PR. If the decision is made to decline, the API WG chair will then comment on the PR with `API Declined` and the bot will update `api-review/requested 🗳` to `api-review/declined ❌`. + +## Deprecation Review + +The bot controls the deprecation review lifecycle on behalf of the [Releases Working Group](https://github.com/electron/governance/tree/main/wg-releases). + +Proper deprecation of APIs requires several changes: calling out the deprecation in the "Breaking Changes" doc, adding deprecation warnings to usage of the APIs, updating the docs to mark the APIs as deprecated, etc. Removing a deprecated API requires similar changes. + +Since it's easy for one of these changes to be missed in a code review, this bot provides a checklist to ensure nothing has been forgotten. When a PR is labeled with `deprecation-review/requested 📝` the bot will make a comment on the PR with a checklist of items that should be confirmed to follow deprecation policy. + +When deprecation review is requested, the bot also adds a GitHub Check on the PR. When all items on the checklist have been checked off (and any non-applicable items are removed) the check will be marked as completed. At that point the bot will update `deprecation-review/requested 📝` to `deprecation-review/complete ✅`. diff --git a/spec/deprecation-review-state.spec.ts b/spec/deprecation-review-state.spec.ts new file mode 100644 index 0000000..5fb95f3 --- /dev/null +++ b/spec/deprecation-review-state.spec.ts @@ -0,0 +1,411 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +import { Probot, Context } from 'probot'; +import * as nock from 'nock'; + +import { + addOrUpdateDeprecationReviewCheck, + isChecklistComment, + isReviewLabel, + maybeAddChecklistComment, + setupDeprecationReviewStateManagement, +} from '../src/deprecation-review-state'; +import { + REVIEW_LABELS, + DEPRECATION_REVIEW_CHECK_NAME, + DEPRECATION_REVIEW_LABELS, +} from '../src/constants'; + +import { CheckRunStatus } from '../src/enums'; + +const handler = async (app: Probot) => { + setupDeprecationReviewStateManagement(app); +}; + +const CHECKLIST_COMMENT = fs.readFileSync( + path.join(__dirname, '..', 'src', 'deprecation-checklist.md'), + 'utf-8', +); + +describe('deprecation review', () => { + let robot: Probot; + let moctokit: any; + + beforeEach(() => { + nock.disableNetConnect(); + robot = new Probot({ + githubToken: 'test', + secret: 'secret', + privateKey: 'private key', + appId: 690857, + }); + + moctokit = { + issues: { + addLabels: jest.fn().mockReturnValue({ data: [] }), + createComment: jest.fn().mockResolvedValue({}), + listLabelsOnIssue: jest.fn().mockReturnValue({ data: [] }), + listComments: jest.fn().mockReturnValue({ data: [] }), + removeLabel: jest.fn().mockReturnValue({ data: [] }), + }, + checks: { + listForRef: jest.fn().mockReturnValue({ data: { check_runs: [] } }), + create: jest.fn().mockReturnValue({ data: {} }), + update: jest.fn().mockReturnValue({ data: {} }), + }, + teams: { + listMembersInOrg: jest.fn().mockReturnValue({ data: [] }), + }, + pulls: { + listReviews: jest.fn().mockReturnValue({ data: [] }), + }, + } as any as Context['octokit']; + + robot.load(handler); + }); + + afterEach(() => { + nock.cleanAll(); + }); + + describe('isReviewLabel', () => { + it('should return true for review labels', () => { + expect(isReviewLabel(DEPRECATION_REVIEW_LABELS.REQUESTED)).toEqual(true); + expect(isReviewLabel(DEPRECATION_REVIEW_LABELS.COMPLETE)).toEqual(true); + }); + + it('should return false for any other labels', () => { + expect(isReviewLabel(REVIEW_LABELS.APPROVED)).toEqual(false); + }); + }); + + describe('isChecklistComment', () => { + it('should return true for the checklist comment', () => { + const { + comment, + } = require('./fixtures/deprecation-review-state/issue_comment.checklist_complete.json'); + expect(isChecklistComment(comment)).toEqual(true); + }); + + it('should false true for any other comment', () => { + const { comment } = require('./fixtures/deprecation-review-state/issue_comment.edited.json'); + expect(isChecklistComment(comment)).toEqual(false); + }); + }); + + describe('addOrUpdateDeprecationReviewCheck', () => { + it('should reset the check when PR does not have a deprecation review label', async () => { + const { + pull_request, + } = require('./fixtures/deprecation-review-state/pull_request.no_review_label.json'); + + moctokit.checks.listForRef = jest.fn().mockReturnValue({ + data: { + check_runs: [ + { + name: DEPRECATION_REVIEW_CHECK_NAME, + id: '12345', + }, + ], + }, + }); + + const expected = { + name: DEPRECATION_REVIEW_CHECK_NAME, + status: 'completed', + output: { + title: 'Outdated', + summary: `PR no longer requires ${DEPRECATION_REVIEW_CHECK_NAME}`, + }, + conclusion: CheckRunStatus.NEUTRAL, + }; + + await addOrUpdateDeprecationReviewCheck(moctokit, pull_request); + expect(moctokit.checks.update).toHaveBeenCalledWith(expect.objectContaining(expected)); + + expect(moctokit.issues.addLabels).not.toHaveBeenCalled(); + expect(moctokit.issues.removeLabel).not.toHaveBeenCalled(); + + expect(moctokit.checks.listForRef).toHaveBeenCalled(); + expect(moctokit.checks.update).toHaveBeenCalled(); + }); + + it(`should create the check for a PR with the ${DEPRECATION_REVIEW_LABELS.REQUESTED} label`, async () => { + const { + pull_request, + } = require('./fixtures/deprecation-review-state/pull_request.requested_review_label.json'); + + moctokit.checks.listForRef = jest.fn().mockReturnValue({ + data: { + check_runs: [], + }, + }); + + const expected = { + name: DEPRECATION_REVIEW_CHECK_NAME, + status: 'in_progress', + output: { + title: 'Pending', + summary: 'Review in-progress', + }, + }; + + await addOrUpdateDeprecationReviewCheck(moctokit, pull_request); + expect(moctokit.checks.create).toHaveBeenCalledWith(expect.objectContaining(expected)); + }); + + it('should not use Checks API when the PR is from a fork', async () => { + const { + pull_request, + } = require('./fixtures/deprecation-review-state/pull_request.requested_review_label.json'); + + pull_request.head.repo.fork = true; + + await addOrUpdateDeprecationReviewCheck(moctokit, pull_request); + expect(moctokit.checks.create).not.toHaveBeenCalled(); + expect(moctokit.checks.update).not.toHaveBeenCalled(); + }); + + it(`should correctly update deprecation review check for ${DEPRECATION_REVIEW_LABELS.COMPLETE} label`, async () => { + const payload = require('./fixtures/deprecation-review-state/pull_request.review_complete_label.json'); + + moctokit.checks.listForRef = jest.fn().mockReturnValue({ + data: { + check_runs: [ + { + name: DEPRECATION_REVIEW_CHECK_NAME, + id: '12345', + }, + ], + }, + }); + + const expected = { + name: DEPRECATION_REVIEW_CHECK_NAME, + status: 'completed', + output: { + title: 'Complete', + summary: 'All review items have been checked off', + }, + conclusion: CheckRunStatus.SUCCESS, + }; + + await addOrUpdateDeprecationReviewCheck(moctokit, payload.pull_request); + expect(moctokit.checks.update).toHaveBeenCalledWith(expect.objectContaining(expected)); + }); + }); + + describe('maybeAddChecklistComment', () => { + it('should comment on the PR when Deprecation Review is requested', async () => { + const { + pull_request, + } = require('./fixtures/deprecation-review-state/pull_request.requested_review_label.json'); + + await maybeAddChecklistComment(moctokit, pull_request); + expect(moctokit.issues.createComment).toHaveBeenCalledWith( + expect.objectContaining({ + body: CHECKLIST_COMMENT, + }), + ); + }); + + it('should not comment on a PR when no Deprecation Review is requested', async () => { + const { + pull_request, + } = require('./fixtures/deprecation-review-state/pull_request.no_review_label.json'); + + await maybeAddChecklistComment(moctokit, pull_request); + expect(moctokit.issues.createComment).not.toHaveBeenCalled(); + }); + + it('should not comment on the PR when the comment already exists', async () => { + const { + pull_request, + } = require('./fixtures/deprecation-review-state/pull_request.requested_review_label.json'); + + moctokit.issues.listComments = jest.fn().mockReturnValue({ + data: [ + { + user: { + login: 'bot', + }, + body: CHECKLIST_COMMENT, + }, + ], + }); + + await maybeAddChecklistComment(moctokit, pull_request); + expect(moctokit.issues.createComment).not.toHaveBeenCalled(); + }); + }); + + it(`creates the deprecation review check and comments when review is requested`, async () => { + const payload = require('./fixtures/deprecation-review-state/pull_request.requested_review_label.json'); + + nock('https://api.github.com') + .get( + `/repos/dsanders11/deprecation-review/commits/${payload.pull_request.head.sha}/check-runs?per_page=100`, + ) + .reply(200, { + check_runs: [], + }); + + nock('https://api.github.com') + .get( + `/repos/dsanders11/deprecation-review/issues/${payload.pull_request.number}/comments?per_page=100`, + ) + .reply(200, []); + + const expected = { + name: DEPRECATION_REVIEW_CHECK_NAME, + status: 'in_progress', + output: { + title: 'Pending', + summary: 'Review in-progress', + }, + }; + + nock('https://api.github.com') + .post(`/repos/dsanders11/deprecation-review/check-runs/`, (body) => { + expect(body).toMatchObject(expected); + return true; + }) + .reply(200); + + nock('https://api.github.com') + .post( + `/repos/dsanders11/deprecation-review/issues/${payload.pull_request.number}/comments`, + ({ body }) => { + expect(body).toEqual(CHECKLIST_COMMENT); + return true; + }, + ) + .reply(200); + + await robot.receive({ + id: '123-456', + name: 'pull_request', + payload, + }); + }); + + it(`correctly updates deprecation review check when no review labels are found`, async () => { + const payload = require('./fixtures/deprecation-review-state/pull_request.no_review_label.json'); + + nock('https://api.github.com') + .get( + `/repos/dsanders11/deprecation-review/commits/${payload.pull_request.head.sha}/check-runs?per_page=100`, + ) + .reply(200, { + check_runs: [ + { + name: DEPRECATION_REVIEW_CHECK_NAME, + id: '12345', + }, + ], + }); + + const expected = { + name: DEPRECATION_REVIEW_CHECK_NAME, + status: 'completed', + output: { + title: 'Outdated', + summary: `PR no longer requires ${DEPRECATION_REVIEW_CHECK_NAME}`, + }, + conclusion: CheckRunStatus.NEUTRAL, + }; + + nock('https://api.github.com') + .patch(`/repos/dsanders11/deprecation-review/check-runs/12345`, (body) => { + expect(body).toMatchObject(expected); + return true; + }) + .reply(200); + + await robot.receive({ + id: '123-456', + name: 'pull_request', + payload, + }); + }); + + it('correctly updates deprecation review check and deprecation review label when pr is unlabeled', async () => { + const payload = require('./fixtures/deprecation-review-state/pull_request.unlabeled.json'); + + nock('https://api.github.com') + .get( + `/repos/dsanders11/deprecation-review/issues/${payload.number}/labels?per_page=100&page=1`, + ) + .reply(200, []); + + nock('https://api.github.com') + .post(`/repos/dsanders11/deprecation-review/issues/${payload.number}/labels`, (body) => { + expect(body).toEqual([DEPRECATION_REVIEW_LABELS.COMPLETE]); + return true; + }) + .reply(200); + + await robot.receive({ + id: '123-456', + name: 'pull_request', + payload, + }); + }); + + it('does nothing for an edited comment that is not the deprecation checklist', async () => { + const payload = require('./fixtures/deprecation-review-state/issue_comment.edited.json'); + + await robot.receive({ + id: '123-456', + name: 'issue_comment', + payload, + }); + expect(nock.isDone()).toEqual(true); + }); + + it('correctly updates deprecation review check and deprecation review label when checklist complete', async () => { + const payload = require('./fixtures/deprecation-review-state/issue_comment.checklist_complete.json'); + + nock('https://api.github.com') + .get( + `/repos/dsanders11/deprecation-review/issues/${payload.number}/labels?per_page=100&page=1`, + ) + .reply(200, [DEPRECATION_REVIEW_LABELS.REQUESTED]); + + nock('https://api.github.com') + .post(`/repos/dsanders11/deprecation-review/issues/${payload.number}/labels`, (body) => { + expect(body).toEqual([DEPRECATION_REVIEW_LABELS.REQUESTED]); + return true; + }) + .reply(200) + .post(`/repos/dsanders11/deprecation-review/issues/${payload.number}/labels`, (body) => { + expect(body).toEqual([DEPRECATION_REVIEW_LABELS.COMPLETE]); + return true; + }) + .reply(200); + + const expected = { + name: DEPRECATION_REVIEW_CHECK_NAME, + status: 'completed', + output: { + title: 'Complete', + summary: 'All review items have been checked off', + }, + conclusion: CheckRunStatus.SUCCESS, + }; + + nock('https://api.github.com') + .patch(`/repos/dsanders11/deprecation-review/check-runs/12345`, (body) => { + expect(body).toMatchObject(expected); + return true; + }) + .reply(200); + + await robot.receive({ + id: '123-456', + name: 'issue_comment', + payload, + }); + }); +}); diff --git a/spec/fixtures/deprecation-review-state/issue_comment.checklist_complete.json b/spec/fixtures/deprecation-review-state/issue_comment.checklist_complete.json new file mode 100644 index 0000000..e34d7f9 --- /dev/null +++ b/spec/fixtures/deprecation-review-state/issue_comment.checklist_complete.json @@ -0,0 +1,240 @@ +{ + "action": "edited", + "changes": { + "body": { + "from": "## 🪦 Deprecation Checklist\r\n\r\n### 🔥 New deprecations in this PR\r\n\r\n- [x] 📢 Are called out in [`docs/breaking-changes.md`][]\r\n- [x] ⚠️ Use the deprecation helpers in [`lib/common/deprecate.ts`](https://github.com/electron/electron/blob/main/lib/common/deprecate.ts) to warn about usage (including events)\r\n- [ ] 📝 Are marked as deprecated in the docs, using `_Deprecated_` (including properties and events)\r\n\r\n[`docs/breaking-changes.md`]: https://github.com/electron/electron/blob/main/docs/breaking-changes.md" + } + }, + "issue": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "repository_url": "https://api.github.com/repos/dsanders11/deprecation-review", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/labels{/name}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/events", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "id": 1846060956, + "node_id": "PR_kwDOKE6NNM5Xr6RG", + "number": 1, + "title": "chore: test", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 2, + "created_at": "2023-08-11T00:52:02Z", + "updated_at": "2023-08-11T01:59:33Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "draft": false, + "pull_request": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "diff_url": "https://github.com/dsanders11/deprecation-review/pull/1.diff", + "patch_url": "https://github.com/dsanders11/deprecation-review/pull/1.patch", + "merged_at": null + }, + "body": "This is a test PR with no deprecation review label.", + "reactions": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/timeline", + "performed_via_github_app": null, + "state_reason": null + }, + "comment": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments/1674130054", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1#issuecomment-1674130054", + "issue_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "id": 1674130054, + "node_id": "IC_kwDOKE6NNM5jyTKG", + "user": { + "login": "bot", + "id": 41898282, + "node_id": "MDM6Qm90NDE4OTgyODI=", + "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-actions%5Bbot%5D", + "html_url": "https://github.com/apps/github-actions", + "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "created_at": "2023-08-11T01:58:23Z", + "updated_at": "2023-08-11T01:59:33Z", + "author_association": "NONE", + "body": "## 🪦 Deprecation Checklist\r\n\r\n### 🔥 New deprecations in this PR\r\n\r\n- [x] 📢 Are called out in [`docs/breaking-changes.md`][]\r\n- [x] ⚠️ Use the deprecation helpers in [`lib/common/deprecate.ts`](https://github.com/electron/electron/blob/main/lib/common/deprecate.ts) to warn about usage (including events)\r\n- [x] 📝 Are marked as deprecated in the docs, using `_Deprecated_` (including properties and events)\r\n\r\n[`docs/breaking-changes.md`]: https://github.com/electron/electron/blob/main/docs/breaking-changes.md", + "reactions": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments/1674130054/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + "repository": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T01:58:01Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 1, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main" + }, + "sender": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/spec/fixtures/deprecation-review-state/issue_comment.edited.json b/spec/fixtures/deprecation-review-state/issue_comment.edited.json new file mode 100644 index 0000000..361dc2a --- /dev/null +++ b/spec/fixtures/deprecation-review-state/issue_comment.edited.json @@ -0,0 +1,240 @@ +{ + "action": "edited", + "changes": { + "body": { + "from": "This is a human comment." + } + }, + "issue": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "repository_url": "https://api.github.com/repos/dsanders11/deprecation-review", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/labels{/name}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/events", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "id": 1846060956, + "node_id": "PR_kwDOKE6NNM5Xr6RG", + "number": 1, + "title": "chore: test", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 1, + "created_at": "2023-08-11T00:52:02Z", + "updated_at": "2023-08-11T01:41:59Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "draft": false, + "pull_request": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "diff_url": "https://github.com/dsanders11/deprecation-review/pull/1.diff", + "patch_url": "https://github.com/dsanders11/deprecation-review/pull/1.patch", + "merged_at": null + }, + "body": "This is a test PR with no deprecation review label.", + "reactions": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/timeline", + "performed_via_github_app": null, + "state_reason": null + }, + "comment": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments/1674121507", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1#issuecomment-1674121507", + "issue_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "id": 1674121507, + "node_id": "IC_kwDOKE6NNM5jyREj", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2023-08-11T01:41:44Z", + "updated_at": "2023-08-11T01:41:59Z", + "author_association": "OWNER", + "body": "This is a human comment being edited.", + "reactions": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments/1674121507/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + "repository": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main" + }, + "sender": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/spec/fixtures/deprecation-review-state/pull_request.no_review_label.json b/spec/fixtures/deprecation-review-state/pull_request.no_review_label.json new file mode 100644 index 0000000..bcf493f --- /dev/null +++ b/spec/fixtures/deprecation-review-state/pull_request.no_review_label.json @@ -0,0 +1,488 @@ +{ + "action": "opened", + "number": 1, + "pull_request": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1", + "id": 1471128646, + "node_id": "PR_kwDOKE6NNM5Xr6RG", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "diff_url": "https://github.com/dsanders11/deprecation-review/pull/1.diff", + "patch_url": "https://github.com/dsanders11/deprecation-review/pull/1.patch", + "issue_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "number": 1, + "state": "open", + "locked": false, + "title": "chore: test", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a test PR with no deprecation review label.", + "created_at": "2023-08-11T00:52:02Z", + "updated_at": "2023-08-11T00:52:02Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits", + "review_comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments", + "review_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3", + "head": { + "label": "dsanders11:test", + "ref": "test", + "sha": "aab2cdeab3d1351372c8ee48527820aed5c53af3", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "dsanders11:main", + "ref": "main", + "sha": "c3c0e7389b34023a4b4247e0b72cb086f701614e", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1" + }, + "html": { + "href": "https://github.com/dsanders11/deprecation-review/pull/1" + }, + "issue": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1" + }, + "comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 2, + "deletions": 0, + "changed_files": 1 + }, + "repository": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main" + }, + "sender": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/spec/fixtures/deprecation-review-state/pull_request.requested_review_label.json b/spec/fixtures/deprecation-review-state/pull_request.requested_review_label.json new file mode 100644 index 0000000..eeeaac4 --- /dev/null +++ b/spec/fixtures/deprecation-review-state/pull_request.requested_review_label.json @@ -0,0 +1,507 @@ +{ + "action": "labeled", + "number": 1, + "pull_request": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1", + "id": 1471128646, + "node_id": "PR_kwDOKE6NNM5Xr6RG", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "diff_url": "https://github.com/dsanders11/deprecation-review/pull/1.diff", + "patch_url": "https://github.com/dsanders11/deprecation-review/pull/1.patch", + "issue_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "number": 1, + "state": "open", + "locked": false, + "title": "chore: test", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a test PR with no deprecation review label.", + "created_at": "2023-08-11T00:52:02Z", + "updated_at": "2023-08-11T00:53:43Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "aacc094d7b5e83a81ec19f018eb00a6cfb3b49c6", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [ + { + "id": 5824334761, + "node_id": "LA_kwDOKE6NNM8AAAABWyhLqQ", + "url": "https://api.github.com/repos/dsanders11/deprecation-review/labels/deprecation-review/requested%20%F0%9F%93%9D", + "name": "deprecation-review/requested 📝", + "color": "c5def5", + "default": false, + "description": "" + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits", + "review_comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments", + "review_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3", + "head": { + "label": "dsanders11:test", + "ref": "test", + "sha": "aab2cdeab3d1351372c8ee48527820aed5c53af3", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "dsanders11:main", + "ref": "main", + "sha": "c3c0e7389b34023a4b4247e0b72cb086f701614e", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1" + }, + "html": { + "href": "https://github.com/dsanders11/deprecation-review/pull/1" + }, + "issue": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1" + }, + "comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 2, + "deletions": 0, + "changed_files": 1 + }, + "label": { + "id": 5824334761, + "node_id": "LA_kwDOKE6NNM8AAAABWyhLqQ", + "url": "https://api.github.com/repos/dsanders11/deprecation-review/labels/deprecation-review/requested%20%F0%9F%93%9D", + "name": "deprecation-review/requested 📝", + "color": "c5def5", + "default": false, + "description": "" + }, + "repository": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main" + }, + "sender": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/spec/fixtures/deprecation-review-state/pull_request.review_complete_label.json b/spec/fixtures/deprecation-review-state/pull_request.review_complete_label.json new file mode 100644 index 0000000..a855d13 --- /dev/null +++ b/spec/fixtures/deprecation-review-state/pull_request.review_complete_label.json @@ -0,0 +1,376 @@ +{ + "pull_request": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1", + "id": 1471128646, + "node_id": "PR_kwDOKE6NNM5Xr6RG", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "diff_url": "https://github.com/dsanders11/deprecation-review/pull/1.diff", + "patch_url": "https://github.com/dsanders11/deprecation-review/pull/1.patch", + "issue_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "number": 1, + "state": "open", + "locked": false, + "title": "chore: test", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a test PR with no deprecation review label.", + "created_at": "2023-08-11T00:52:02Z", + "updated_at": "2023-08-11T01:18:38Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "aacc094d7b5e83a81ec19f018eb00a6cfb3b49c6", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [ + { + "id": 5824336588, + "node_id": "LA_kwDOKE6NNM8AAAABWyhSzA", + "url": "https://api.github.com/repos/dsanders11/deprecation-review/labels/deprecation-review/complete%20%E2%9C%85", + "name": "deprecation-review/complete ✅", + "color": "0e8a16", + "default": false, + "description": "" + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits", + "review_comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments", + "review_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3", + "head": { + "label": "dsanders11:test", + "ref": "test", + "sha": "aab2cdeab3d1351372c8ee48527820aed5c53af3", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "dsanders11:main", + "ref": "main", + "sha": "c3c0e7389b34023a4b4247e0b72cb086f701614e", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1" + }, + "html": { + "href": "https://github.com/dsanders11/deprecation-review/pull/1" + }, + "issue": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1" + }, + "comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 2, + "deletions": 0, + "changed_files": 1 + } +} \ No newline at end of file diff --git a/spec/fixtures/deprecation-review-state/pull_request.unlabeled.json b/spec/fixtures/deprecation-review-state/pull_request.unlabeled.json new file mode 100644 index 0000000..1528b76 --- /dev/null +++ b/spec/fixtures/deprecation-review-state/pull_request.unlabeled.json @@ -0,0 +1,497 @@ +{ + "action": "unlabeled", + "number": 1, + "pull_request": { + "url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1", + "id": 1471128646, + "node_id": "PR_kwDOKE6NNM5Xr6RG", + "html_url": "https://github.com/dsanders11/deprecation-review/pull/1", + "diff_url": "https://github.com/dsanders11/deprecation-review/pull/1.diff", + "patch_url": "https://github.com/dsanders11/deprecation-review/pull/1.patch", + "issue_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1", + "number": 1, + "state": "open", + "locked": false, + "title": "chore: test", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a test PR with no deprecation review label.", + "created_at": "2023-08-11T00:52:02Z", + "updated_at": "2023-08-11T01:35:31Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "aacc094d7b5e83a81ec19f018eb00a6cfb3b49c6", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits", + "review_comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments", + "review_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3", + "head": { + "label": "dsanders11:test", + "ref": "test", + "sha": "aab2cdeab3d1351372c8ee48527820aed5c53af3", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "dsanders11:main", + "ref": "main", + "sha": "c3c0e7389b34023a4b4247e0b72cb086f701614e", + "user": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1" + }, + "html": { + "href": "https://github.com/dsanders11/deprecation-review/pull/1" + }, + "issue": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1" + }, + "comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/issues/1/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/pulls/1/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/aab2cdeab3d1351372c8ee48527820aed5c53af3" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 2, + "deletions": 0, + "changed_files": 1 + }, + "label": { + "id": 5824336588, + "node_id": "LA_kwDOKE6NNM8AAAABWyhSzA", + "url": "https://api.github.com/repos/dsanders11/deprecation-review/labels/deprecation-review/complete%20%E2%9C%85", + "name": "deprecation-review/complete ✅", + "color": "0e8a16", + "default": false, + "description": "" + }, + "repository": { + "id": 676236596, + "node_id": "R_kgDOKE6NNA", + "name": "deprecation-review", + "full_name": "dsanders11/deprecation-review", + "private": false, + "owner": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/dsanders11/deprecation-review", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/dsanders11/deprecation-review", + "forks_url": "https://api.github.com/repos/dsanders11/deprecation-review/forks", + "keys_url": "https://api.github.com/repos/dsanders11/deprecation-review/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/dsanders11/deprecation-review/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/dsanders11/deprecation-review/teams", + "hooks_url": "https://api.github.com/repos/dsanders11/deprecation-review/hooks", + "issue_events_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/events{/number}", + "events_url": "https://api.github.com/repos/dsanders11/deprecation-review/events", + "assignees_url": "https://api.github.com/repos/dsanders11/deprecation-review/assignees{/user}", + "branches_url": "https://api.github.com/repos/dsanders11/deprecation-review/branches{/branch}", + "tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/tags", + "blobs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/dsanders11/deprecation-review/statuses/{sha}", + "languages_url": "https://api.github.com/repos/dsanders11/deprecation-review/languages", + "stargazers_url": "https://api.github.com/repos/dsanders11/deprecation-review/stargazers", + "contributors_url": "https://api.github.com/repos/dsanders11/deprecation-review/contributors", + "subscribers_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscribers", + "subscription_url": "https://api.github.com/repos/dsanders11/deprecation-review/subscription", + "commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/dsanders11/deprecation-review/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/dsanders11/deprecation-review/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/dsanders11/deprecation-review/contents/{+path}", + "compare_url": "https://api.github.com/repos/dsanders11/deprecation-review/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/dsanders11/deprecation-review/merges", + "archive_url": "https://api.github.com/repos/dsanders11/deprecation-review/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/dsanders11/deprecation-review/downloads", + "issues_url": "https://api.github.com/repos/dsanders11/deprecation-review/issues{/number}", + "pulls_url": "https://api.github.com/repos/dsanders11/deprecation-review/pulls{/number}", + "milestones_url": "https://api.github.com/repos/dsanders11/deprecation-review/milestones{/number}", + "notifications_url": "https://api.github.com/repos/dsanders11/deprecation-review/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/dsanders11/deprecation-review/labels{/name}", + "releases_url": "https://api.github.com/repos/dsanders11/deprecation-review/releases{/id}", + "deployments_url": "https://api.github.com/repos/dsanders11/deprecation-review/deployments", + "created_at": "2023-08-08T18:33:36Z", + "updated_at": "2023-08-11T00:41:43Z", + "pushed_at": "2023-08-11T00:52:03Z", + "git_url": "git://github.com/dsanders11/deprecation-review.git", + "ssh_url": "git@github.com:dsanders11/deprecation-review.git", + "clone_url": "https://github.com/dsanders11/deprecation-review.git", + "svn_url": "https://github.com/dsanders11/deprecation-review", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "main" + }, + "sender": { + "login": "dsanders11", + "id": 5820654, + "node_id": "MDQ6VXNlcjU4MjA2NTQ=", + "avatar_url": "https://avatars.githubusercontent.com/u/5820654?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dsanders11", + "html_url": "https://github.com/dsanders11", + "followers_url": "https://api.github.com/users/dsanders11/followers", + "following_url": "https://api.github.com/users/dsanders11/following{/other_user}", + "gists_url": "https://api.github.com/users/dsanders11/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dsanders11/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dsanders11/subscriptions", + "organizations_url": "https://api.github.com/users/dsanders11/orgs", + "repos_url": "https://api.github.com/users/dsanders11/repos", + "events_url": "https://api.github.com/users/dsanders11/events{/privacy}", + "received_events_url": "https://api.github.com/users/dsanders11/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/src/constants.ts b/src/constants.ts index e62bd32..8202f1c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -40,6 +40,11 @@ export const REVIEW_LABELS = { DECLINED: 'api-review/declined ❌', }; +export const DEPRECATION_REVIEW_LABELS = { + REQUESTED: 'deprecation-review/requested 📝', + COMPLETE: 'deprecation-review/complete ✅', +}; + export const REVIEW_STATUS = { APPROVED: 'APPROVED', CHANGES_REQUESTED: 'CHANGES_REQUESTED', @@ -48,6 +53,8 @@ export const REVIEW_STATUS = { export const API_REVIEW_CHECK_NAME = 'API Review'; +export const DEPRECATION_REVIEW_CHECK_NAME = 'Deprecation Review'; + export const API_WORKING_GROUP = 'wg-api'; // exclusion labels diff --git a/src/deprecation-checklist.md b/src/deprecation-checklist.md new file mode 100644 index 0000000..f43b39e --- /dev/null +++ b/src/deprecation-checklist.md @@ -0,0 +1,21 @@ +## 🪦 Deprecation Checklist + +### 🔥 New deprecations in this PR + +- [ ] 📢 Are called out in [`docs/breaking-changes.md`][] +- [ ] ⚠️ Use the deprecation helpers in [`lib/common/deprecate.ts`](https://github.com/electron/electron/blob/main/lib/common/deprecate.ts) to warn about usage (including events) +- [ ] 📝 Are marked as deprecated in the docs, using `_Deprecated_` (including properties and events) +- [ ] 🧪 Relevant tests are updated to expect deprecation messages using the helpers in [`spec/lib/deprecate-helpers.ts`](https://github.com/electron/electron/blob/main/spec/lib/deprecate-helpers.ts) + +### 🗑️ Previous deprecations being removed in this PR + +- [ ] 📢 Are called out as removed in [`docs/breaking-changes.md`][] +- [ ] 📝 Are fully removed from the docs +- [ ] ⌨️ All relevant code is removed +- [ ] 🧪 [`spec/ts-smoke`](https://github.com/electron/electron/tree/main/spec/ts-smoke) is updated to use `@ts-expect-error` for the removed APIs + +--- + +@electron/wg-releases: Please confirm these deprecation changes conform to our deprecation policies listed in [`docs/breaking-changes.md`][], then check the applicable items in the checklist and remove any non-applicable items. + +[`docs/breaking-changes.md`]: https://github.com/electron/electron/blob/main/docs/breaking-changes.md diff --git a/src/deprecation-review-state.ts b/src/deprecation-review-state.ts new file mode 100644 index 0000000..f561a19 --- /dev/null +++ b/src/deprecation-review-state.ts @@ -0,0 +1,293 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +import { Context, Probot } from 'probot'; +import { log } from './utils/log-util'; +import { DEPRECATION_REVIEW_CHECK_NAME, DEPRECATION_REVIEW_LABELS } from './constants'; +import { CheckRunStatus, LogLevel } from './enums'; +import { getEnvVar } from './utils/env-util'; +import { IssueComment, PullRequest } from '@octokit/webhooks-types'; +import { Endpoints } from '@octokit/types'; +import { addLabels, removeLabel } from './utils/label-utils'; + +const checkTitles = { + [DEPRECATION_REVIEW_LABELS.COMPLETE]: 'Complete', + [DEPRECATION_REVIEW_LABELS.REQUESTED]: 'Pending', +}; + +const isBot = (user: string) => user === getEnvVar('BOT_USER_NAME', 'bot'); +export const isReviewLabel = (label: string) => + Object.values(DEPRECATION_REVIEW_LABELS).includes(label); +export const isChecklistComment = (comment: IssueComment) => + isBot(comment.user.login) && comment.body.startsWith('## 🪦 Deprecation Checklist'); + +export async function addOrUpdateDeprecationReviewCheck( + octokit: Context['octokit'], + pr: PullRequest, +) { + log( + 'addOrUpdateDeprecationReviewCheck', + LogLevel.INFO, + `Validating ${pr.number} by ${pr.user.login}`, + ); + + const fork = pr.head.repo.fork; + const owner = pr.base.repo.owner.login; + const repo = pr.head.repo.name; + + if (fork) { + log( + 'addOrUpdateDeprecationReviewCheck', + LogLevel.INFO, + `${pr.number} is a fork - checks will not be created or updated`, + ); + } + + // Fetch the latest Deprecation Review check for the PR. + const checkRun = fork + ? null + : ( + await octokit.checks.listForRef({ + ref: pr.head.sha, + per_page: 100, + owner, + repo, + }) + ).data.check_runs.find((run) => run.name === DEPRECATION_REVIEW_CHECK_NAME); + + const resetToNeutral = async () => { + if (!checkRun) return; + const params: Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters'] = + { + owner, + repo, + name: DEPRECATION_REVIEW_CHECK_NAME, + status: 'completed', + output: { + title: 'Outdated', + summary: `PR no longer requires ${DEPRECATION_REVIEW_CHECK_NAME}`, + }, + check_run_id: checkRun.id, + conclusion: CheckRunStatus.NEUTRAL, + }; + return await octokit.checks.update(params); + }; + + // We do not care about PRs without a deprecation review label of any kind. + const currentReviewLabel = pr.labels.find(({ name }) => isReviewLabel(name)); + if (!currentReviewLabel) { + await resetToNeutral(); + return; + } + + // If the PR is a fork PR, return early as the Checks API doesn't work. + if (fork) return; + + // Update the GitHub Check with appropriate deprecation review information. + const updateCheck = async ( + opts: Omit< + Endpoints['POST /repos/{owner}/{repo}/check-runs']['parameters'], + 'baseUrl' | 'headers' | 'mediaType' | 'owner' | 'repo' | 'name' | 'head_sha' + >, + ) => { + if ( + checkRun && + (checkRun.status === opts.status || !opts.status || opts.status === 'completed') + ) { + await octokit.checks.update({ + owner: pr.head.repo.owner.login, + repo: pr.head.repo.name, + name: DEPRECATION_REVIEW_CHECK_NAME, + check_run_id: checkRun.id, + ...opts, + }); + } else { + await octokit.checks.create({ + owner: pr.head.repo.owner.login, + repo: pr.head.repo.name, + name: DEPRECATION_REVIEW_CHECK_NAME, + head_sha: pr.head.sha, + ...opts, + }); + } + }; + + if (currentReviewLabel.name === DEPRECATION_REVIEW_LABELS.REQUESTED) { + log( + 'addOrUpdateDeprecationReviewCheck', + LogLevel.INFO, + `Marking Check for ${pr.number} as Deprecation Review requested`, + ); + return updateCheck({ + status: 'in_progress', + output: { + title: `${checkTitles[currentReviewLabel.name]}`, + summary: 'Review in-progress', + }, + }); + } else if (currentReviewLabel.name === DEPRECATION_REVIEW_LABELS.COMPLETE) { + log( + 'addOrUpdateDeprecationReviewCheck', + LogLevel.INFO, + `Marking Check for ${pr.number} as complete`, + ); + return updateCheck({ + status: 'completed', + conclusion: 'success', + output: { + title: checkTitles[currentReviewLabel.name], + summary: 'All review items have been checked off', + }, + }); + } +} + +export async function maybeAddChecklistComment(octokit: Context['octokit'], pr: PullRequest) { + const owner = pr.base.repo.owner.login; + const repo = pr.head.repo.name; + + // We do not care about PRs without the deprecation review requested label. + const currentReviewLabel = pr.labels.find(({ name }) => isReviewLabel(name)); + if (currentReviewLabel?.name !== DEPRECATION_REVIEW_LABELS.REQUESTED) return; + + // Find the checklist comment from the bot, if it exists + const comment = ( + await octokit.issues.listComments({ + owner, + repo, + issue_number: pr.number, + per_page: 100, + }) + ).data.find((comment) => comment.user && isChecklistComment(comment as IssueComment)); + + if (!comment) { + await octokit.issues.createComment({ + owner, + repo, + issue_number: pr.number, + body: fs.readFileSync(path.join(__dirname, 'deprecation-checklist.md'), 'utf-8'), + }); + } +} + +export function setupDeprecationReviewStateManagement(probot: Probot) { + probot.on( + ['pull_request.synchronize', 'pull_request.opened'], + async (context: Context<'pull_request'>) => { + await maybeAddChecklistComment(context.octokit, context.payload.pull_request); + await addOrUpdateDeprecationReviewCheck(context.octokit, context.payload.pull_request); + }, + ); + + /** + * The deprecation-review/requested label initiates deprecation review, + * but the deprecation-review/complete label is solely controlled by cation + */ + probot.on('pull_request.labeled', async (context: Context<'pull_request.labeled'>) => { + const { + label, + pull_request: pr, + sender: { login: initiator }, + } = context.payload; + + if (!label) { + throw new Error('Something went wrong - label does not exist.'); + } + + // Once a PR is merged, allow tampering. + if (pr.merged) return; + + if (isReviewLabel(label.name)) { + if (!isBot(initiator) && label.name !== DEPRECATION_REVIEW_LABELS.REQUESTED) { + probot.log( + `${initiator} tried to add ${label.name} to PR #${pr.number} - this is not permitted.`, + ); + + await removeLabel(context.octokit, { + ...context.repo({}), + prNumber: pr.number, + name: label.name, + }); + } + } + + await maybeAddChecklistComment(context.octokit, context.payload.pull_request); + await addOrUpdateDeprecationReviewCheck(context.octokit, pr); + }); + + /** + * If a PR is unlabeled, we want to ensure solely that a human + * did not remove a deprecation-review state label other than + * deprecation-review-requested. + */ + probot.on('pull_request.unlabeled', async (context: Context<'pull_request.unlabeled'>) => { + const { + label, + pull_request: pr, + sender: { login: initiator }, + } = context.payload; + + if (!label) { + throw new Error('Something went wrong - label does not exist.'); + } + + // Once a PR is merged, allow tampering. + if (pr.merged) return; + + // We want to prevent tampering with deprecation-review/* labels other than + // request labels - the bot should control the full review lifecycle. + if (isReviewLabel(label.name)) { + // The 'deprecation-review/requested 📝' label can be removed. + if (label.name === DEPRECATION_REVIEW_LABELS.REQUESTED) { + // Check will be removed by addOrUpdateDeprecationReviewCheck + } else { + if (!isBot(initiator)) { + probot.log( + `${initiator} tried to remove ${label.name} from PR #${pr.number} - this is not permitted.`, + ); + + await addLabels(context.octokit, { + ...context.repo({}), + prNumber: pr.number, + labels: [label.name], + }); + + return; + } + } + + await addOrUpdateDeprecationReviewCheck(context.octokit, pr); + } + }); + + probot.on('issue_comment.edited', async (context: Context<'issue_comment.edited'>) => { + const { + comment, + issue: { labels, number: prNumber, pull_request: pr }, + } = context.payload; + + if (!pr) return; + + // We do not care about PRs without a deprecation review label of any kind, or + // ones which do not have a deprecation-review/requested label. + const currentReviewLabel = labels.find(({ name }) => isReviewLabel(name)); + if (currentReviewLabel?.name !== DEPRECATION_REVIEW_LABELS.REQUESTED) return; + + // We only care about the checklist comment from this bot + if (!isChecklistComment(comment)) return; + + // If there are no unchecked items then add the review completed label + if (!comment.body.matchAll(/^- \[ \] /gm)) { + await addLabels(context.octokit, { + ...context.repo({}), + prNumber: prNumber, + labels: [DEPRECATION_REVIEW_LABELS.COMPLETE], + }); + await removeLabel(context.octokit, { + ...context.repo({}), + prNumber: prNumber, + name: DEPRECATION_REVIEW_LABELS.REQUESTED, + }); + } + }); +} diff --git a/src/index.ts b/src/index.ts index 4c929af..b17ecb9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import { setUp24HourRule } from './24-hour-rule'; import { setupSemverLabelEnforcement } from './enforce-semver-labels'; import { setupAPIReviewStateManagement } from './api-review-state'; import { addBasicPRLabels } from './add-triage-labels'; +import { setupDeprecationReviewStateManagement } from './deprecation-review-state'; const probotHandler = async (app: Probot) => { app.onError((errorEvent) => { @@ -30,6 +31,7 @@ const probotHandler = async (app: Probot) => { setupSemverLabelEnforcement(app); setupAPIReviewStateManagement(app); addBasicPRLabels(app); + setupDeprecationReviewStateManagement(app); }; module.exports = probotHandler; From 47e5c1ac4013052f437e6282da186db7df0db8cc Mon Sep 17 00:00:00 2001 From: David Sanders Date: Mon, 14 Aug 2023 15:27:51 -0700 Subject: [PATCH 2/3] chore: return earlier for forks Co-authored-by: John Kleinschmidt --- src/deprecation-review-state.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/deprecation-review-state.ts b/src/deprecation-review-state.ts index f561a19..af573bf 100644 --- a/src/deprecation-review-state.ts +++ b/src/deprecation-review-state.ts @@ -41,6 +41,8 @@ export async function addOrUpdateDeprecationReviewCheck( LogLevel.INFO, `${pr.number} is a fork - checks will not be created or updated`, ); + // If the PR is a fork PR, return early as the Checks API doesn't work. + return; } // Fetch the latest Deprecation Review check for the PR. @@ -80,8 +82,6 @@ export async function addOrUpdateDeprecationReviewCheck( return; } - // If the PR is a fork PR, return early as the Checks API doesn't work. - if (fork) return; // Update the GitHub Check with appropriate deprecation review information. const updateCheck = async ( From 1ab1c5c1477608815c442d2fd448ab3d310f2cfb Mon Sep 17 00:00:00 2001 From: David Sanders Date: Mon, 14 Aug 2023 15:33:48 -0700 Subject: [PATCH 3/3] chore: clean up --- src/deprecation-review-state.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/deprecation-review-state.ts b/src/deprecation-review-state.ts index af573bf..0fd6f7e 100644 --- a/src/deprecation-review-state.ts +++ b/src/deprecation-review-state.ts @@ -31,11 +31,10 @@ export async function addOrUpdateDeprecationReviewCheck( `Validating ${pr.number} by ${pr.user.login}`, ); - const fork = pr.head.repo.fork; const owner = pr.base.repo.owner.login; const repo = pr.head.repo.name; - if (fork) { + if (pr.head.repo.fork) { log( 'addOrUpdateDeprecationReviewCheck', LogLevel.INFO, @@ -46,16 +45,14 @@ export async function addOrUpdateDeprecationReviewCheck( } // Fetch the latest Deprecation Review check for the PR. - const checkRun = fork - ? null - : ( - await octokit.checks.listForRef({ - ref: pr.head.sha, - per_page: 100, - owner, - repo, - }) - ).data.check_runs.find((run) => run.name === DEPRECATION_REVIEW_CHECK_NAME); + const checkRun = ( + await octokit.checks.listForRef({ + ref: pr.head.sha, + per_page: 100, + owner, + repo, + }) + ).data.check_runs.find((run) => run.name === DEPRECATION_REVIEW_CHECK_NAME); const resetToNeutral = async () => { if (!checkRun) return; @@ -82,7 +79,6 @@ export async function addOrUpdateDeprecationReviewCheck( return; } - // Update the GitHub Check with appropriate deprecation review information. const updateCheck = async ( opts: Omit<