From 342c8b9db400f0390c9701bced248147310008cf Mon Sep 17 00:00:00 2001 From: James James Date: Tue, 22 Jun 2021 16:58:54 +0100 Subject: [PATCH 1/5] move wip checks to github actions --- actions/src/dispatcher.js | 4 + .../src/pull_requests}/checkWipDraftPR.js | 63 +- actions/src/utils.js | 26 + actions_build/index.js | 143 ++- constants.js | 10 +- fixtures/pullRequest.edited.json | 887 +++++++++--------- index.js | 16 - spec/apiForSheetsSpec.js | 6 - spec/checkCriticalPullRequestSpec.js | 2 - spec/checkNewCronJobSpec.js | 2 - spec/checkPullRequestBranchSpec.js | 3 - spec/checkPullRequestJobSpec.js | 2 - spec/checkPullRequestTemplateSpec.js | 2 - spec/checkWipDraftPRSpec.js | 375 ++++---- 14 files changed, 813 insertions(+), 728 deletions(-) rename {lib => actions/src/pull_requests}/checkWipDraftPR.js (53%) create mode 100644 actions/src/utils.js diff --git a/actions/src/dispatcher.js b/actions/src/dispatcher.js index f23ac49f..e02738c0 100644 --- a/actions/src/dispatcher.js +++ b/actions/src/dispatcher.js @@ -22,6 +22,7 @@ const issueLabelsModule = require('./issues/checkIssueLabels'); const claCheckGithubActionModule = require('./pull_requests/claCheck'); const constants = require('../../constants'); const PRLabelsModule = require('./pull_requests/labelCheck'); +const wipDraftModule = require('./pull_requests/checkWipDraftPR'); module.exports = { async dispatch(event, action) { @@ -49,6 +50,9 @@ module.exports = { case constants.dontMergeLabelCheck: await PRLabelsModule.checkUnLabeled(); break; + case constants.wipCheck: + await wipDraftModule.checkWIP(); + break; } } } diff --git a/lib/checkWipDraftPR.js b/actions/src/pull_requests/checkWipDraftPR.js similarity index 53% rename from lib/checkWipDraftPR.js rename to actions/src/pull_requests/checkWipDraftPR.js index 31ebbf1c..20189da2 100644 --- a/lib/checkWipDraftPR.js +++ b/actions/src/pull_requests/checkWipDraftPR.js @@ -1,4 +1,4 @@ -// Copyright 2020 The Oppia Authors. All Rights Reserved. +// Copyright 2021 The Oppia Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,10 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -const { pingAndAssignUsers } = require('./utils'); +/** + * @fileoverview File to handle checks when a draft or work in progress + * pull request is opened or reopened. + */ + +const core = require('@actions/core'); +const { context, GitHub } = require('@actions/github'); +const { pingAndAssignUsers } = require('../utils'); /** - * @param {import('probot').Octokit.PullsGetResponse} pullRequest + * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest * @returns {Boolean} */ const isDraftPr = (pullRequest) => { @@ -23,7 +30,7 @@ const isDraftPr = (pullRequest) => { }; /** - * @param {import('probot').Octokit.PullsGetResponse} pullRequest + * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest * @returns {Boolean} */ const isWIPPr = ({ title, body }) => { @@ -33,50 +40,50 @@ const isWIPPr = ({ title, body }) => { }; /** - * @param {import('probot').Context} context - * + * @param {import('@octokit/rest').Octokit} octokit + * @returns {Promise} */ -const isSkipCICommit = async (context) => { - /** - * @type {import('probot').Octokit.PullsGetResponse} pullRequest - */ +const isSkipCICommit = async (octokit) => { const pullRequest = context.payload.pull_request; - const commitParams = context.repo({ - commit_sha: pullRequest.head.sha - }); - const commitResponse = await context.github.git.getCommit(commitParams); + const commitParams = { + commit_sha: pullRequest.head.sha, + ...context.repo + }; + const commitResponse = await octokit.git.getCommit(commitParams); return ( commitResponse.data.message.startsWith('[ci skip]') || - commitResponse.data.message.startsWith('[skip ci]')); + commitResponse.data.message.startsWith('[skip ci]') + ); }; -/** - * @param {import('probot').Context} context - */ -module.exports.checkWIP = async (context) => { - /** - * @type {import('probot').Octokit.PullsGetResponse} pullRequest - */ +module.exports.checkWIP = async () => { + const token = core.getInput('repo-token'); + const octokit = new GitHub(token); const pullRequest = context.payload.pull_request; const prAuthor = pullRequest.user.login; if (isDraftPr(pullRequest) || isWIPPr(pullRequest)) { - const hasSkipCIMessage = await isSkipCICommit(context); + const hasSkipCIMessage = await isSkipCICommit(octokit); if (!hasSkipCIMessage) { // Ping and assign PR author. const link = 'here'.link( 'https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia' + - '#wip--draft-pull-requests'); + '#wip--draft-pull-requests' + ); - const commentBody = ( - 'Hi @' + prAuthor + ', when creating WIP/Draft PRs, ensure that ' + + const commentBody = + 'Hi @' + + prAuthor + + ', when creating WIP/Draft PRs, ensure that ' + 'your commit messages are prefixed with **[ci skip]** or ' + '**[skip ci]** to prevent CI checks from running. ' + - 'You can learn more about it ' + link + '.'); + 'You can learn more about it ' + + link + + '.'; - await pingAndAssignUsers(context, pullRequest, [prAuthor], commentBody); + await pingAndAssignUsers(octokit, pullRequest, [prAuthor], commentBody); } } }; diff --git a/actions/src/utils.js b/actions/src/utils.js new file mode 100644 index 00000000..75a6397a --- /dev/null +++ b/actions/src/utils.js @@ -0,0 +1,26 @@ +const { context } = require('@actions/github'); + +/** + * This function pings and assigns all pending reviewers to a pull request. + * @param {import('@octokit/rest').Octokit} octokit + * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest + * @param {string[]} assignees + * @param {string} comment + */ +const pingAndAssignUsers = async (octokit, pullRequest, assignees, comment) => { + await octokit.issues.createComment({ + issue_number: pullRequest.number, + body: comment, + ...context.repo, + }); + + await octokit.issues.addAssignees({ + issue_number: pullRequest.number, + assignees: assignees, + ...context.repo, + }); +}; + +module.exports = { + pingAndAssignUsers, +}; diff --git a/actions_build/index.js b/actions_build/index.js index ef224ab1..30bf579a 100644 --- a/actions_build/index.js +++ b/actions_build/index.js @@ -55282,12 +55282,13 @@ const openEvent = 'opened'; // Github action sends a different type of event. const openEventGithubActions = 'pull_request_target_opened'; const reopenEventGithubActions = 'pull_request_target_reopened'; +const editEventGithubActions = 'pull_request_target_edited'; const reopenEvent = 'pull_request_reopened'; const PRUnlabelEvent = 'pull_request_unlabeled'; const PRLabelEvent = 'pull_request_labeled'; const synchronizeEvent = 'synchronize'; const closeEvent = 'closed'; -const editEvent = 'edited'; +const editEvent = 'pull_request_edited'; const issuesLabelEvent = 'issues_labeled'; const issuesAssignedEvent = 'issues_assigned'; const pushEvent = 'push'; @@ -55346,19 +55347,18 @@ const checksWhitelist = { changelogCheck, codeOwnerCheck, branchCheck, - wipCheck, jobCheck, cronJobCheck, modelCheck, prTemplateCheck ], - [openEventGithubActions]: [claCheckGithubAction], - [reopenEventGithubActions]: [claCheckGithubAction], + [openEventGithubActions]: [claCheckGithubAction, wipCheck], + [reopenEventGithubActions]: [claCheckGithubAction, wipCheck], + [editEventGithubActions]: [wipCheck], [reopenEvent]: [ changelogCheck, claCheckGithubAction, branchCheck, - wipCheck, jobCheck, cronJobCheck, modelCheck, @@ -88804,7 +88804,38 @@ exports.default = promisify; /***/ }), /* 255 */, -/* 256 */, +/* 256 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const { context } = __webpack_require__(469); + +/** + * This function pings and assigns all pending reviewers to a pull request. + * @param {import('@octokit/rest').Octokit} octokit + * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest + * @param {string[]} assignees + * @param {string} comment + */ +const pingAndAssignUsers = async (octokit, pullRequest, assignees, comment) => { + await octokit.issues.createComment({ + issue_number: pullRequest.number, + body: comment, + ...context.repo, + }); + + await octokit.issues.addAssignees({ + issue_number: pullRequest.number, + assignees: assignees, + ...context.repo, + }); +}; + +module.exports = { + pingAndAssignUsers, +}; + + +/***/ }), /* 257 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -240584,6 +240615,7 @@ const issueLabelsModule = __webpack_require__(293); const claCheckGithubActionModule = __webpack_require__(373); const constants = __webpack_require__(208); const PRLabelsModule = __webpack_require__(626); +const wipDraftModule = __webpack_require__(911); module.exports = { async dispatch(event, action) { @@ -240611,6 +240643,9 @@ module.exports = { case constants.dontMergeLabelCheck: await PRLabelsModule.checkUnLabeled(); break; + case constants.wipCheck: + await wipDraftModule.checkWIP(); + break; } } } @@ -289178,7 +289213,101 @@ var servicenetworking_v1beta; /***/ }), /* 909 */, /* 910 */, -/* 911 */, +/* 911 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +// Copyright 2021 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview File to handle checks when a draft or work in progress + * pull request is opened or reopened. + */ + +const core = __webpack_require__(470); +const { context, GitHub } = __webpack_require__(469); +const { pingAndAssignUsers } = __webpack_require__(256); + +/** + * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest + * @returns {Boolean} + */ +const isDraftPr = (pullRequest) => { + return pullRequest.draft; +}; + +/** + * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest + * @returns {Boolean} + */ +const isWIPPr = ({ title, body }) => { + return ( + title.toLowerCase().includes('wip') || body.toLowerCase().includes('wip') + ); +}; + +/** + * @param {import('@octokit/rest').Octokit} octokit + * @returns {Promise} + */ +const isSkipCICommit = async (octokit) => { + const pullRequest = context.payload.pull_request; + + const commitParams = { + commit_sha: pullRequest.head.sha, + ...context.repo + }; + const commitResponse = await octokit.git.getCommit(commitParams); + + return ( + commitResponse.data.message.startsWith('[ci skip]') || + commitResponse.data.message.startsWith('[skip ci]') + ); +}; + +module.exports.checkWIP = async () => { + const token = core.getInput('repo-token'); + const octokit = new GitHub(token); + const pullRequest = context.payload.pull_request; + const prAuthor = pullRequest.user.login; + + if (isDraftPr(pullRequest) || isWIPPr(pullRequest)) { + const hasSkipCIMessage = await isSkipCICommit(octokit); + if (!hasSkipCIMessage) { + // Ping and assign PR author. + const link = 'here'.link( + 'https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia' + + '#wip--draft-pull-requests' + ); + + const commentBody = + 'Hi @' + + prAuthor + + ', when creating WIP/Draft PRs, ensure that ' + + 'your commit messages are prefixed with **[ci skip]** or ' + + '**[skip ci]** to prevent CI checks from running. ' + + 'You can learn more about it ' + + link + + '.'; + + await pingAndAssignUsers(octokit, pullRequest, [prAuthor], commentBody); + } + } +}; + + +/***/ }), /* 912 */, /* 913 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { diff --git a/constants.js b/constants.js index c386e733..72ead2b4 100644 --- a/constants.js +++ b/constants.js @@ -16,12 +16,13 @@ const openEvent = 'opened'; // Github action sends a different type of event. const openEventGithubActions = 'pull_request_target_opened'; const reopenEventGithubActions = 'pull_request_target_reopened'; +const editEventGithubActions = 'pull_request_target_edited'; const reopenEvent = 'pull_request_reopened'; const PRUnlabelEvent = 'pull_request_unlabeled'; const PRLabelEvent = 'pull_request_labeled'; const synchronizeEvent = 'synchronize'; const closeEvent = 'closed'; -const editEvent = 'edited'; +const editEvent = 'pull_request_edited'; const issuesLabelEvent = 'issues_labeled'; const issuesAssignedEvent = 'issues_assigned'; const pushEvent = 'push'; @@ -80,19 +81,18 @@ const checksWhitelist = { changelogCheck, codeOwnerCheck, branchCheck, - wipCheck, jobCheck, cronJobCheck, modelCheck, prTemplateCheck ], - [openEventGithubActions]: [claCheckGithubAction], - [reopenEventGithubActions]: [claCheckGithubAction], + [openEventGithubActions]: [claCheckGithubAction, wipCheck], + [reopenEventGithubActions]: [claCheckGithubAction, wipCheck], + [editEventGithubActions]: [wipCheck], [reopenEvent]: [ changelogCheck, claCheckGithubAction, branchCheck, - wipCheck, jobCheck, cronJobCheck, modelCheck, diff --git a/fixtures/pullRequest.edited.json b/fixtures/pullRequest.edited.json index ec26fff6..c6b64fdf 100644 --- a/fixtures/pullRequest.edited.json +++ b/fixtures/pullRequest.edited.json @@ -1,20 +1,93 @@ { - "name": "pull_request", - "payload": { - "action": "edited", - "number": 15, - "pull_request": { - "url": "https://api.github.com/repos/oppia/oppia/pulls/5139", - "id": 196798471, - "node_id": "MDExOlB1bGxSZXF1ZXN0MTk2Nzk4NDcx", - "html_url": "https://github.com/oppia/oppia/pull/5139", - "diff_url": "https://github.com/oppia/oppia/pull/5139.diff", - "patch_url": "https://github.com/oppia/oppia/pull/5139.patch", - "issue_url": "https://api.github.com/repos/oppia/oppia/issues/5139", - "number": 5139, - "state": "open", - "locked": false, - "title": "WIP Exploration editor Page Object", + "action": "edited", + "number": 15, + "pull_request": { + "url": "https://api.github.com/repos/oppia/oppia/pulls/5139", + "id": 196798471, + "node_id": "MDExOlB1bGxSZXF1ZXN0MTk2Nzk4NDcx", + "html_url": "https://github.com/oppia/oppia/pull/5139", + "diff_url": "https://github.com/oppia/oppia/pull/5139.diff", + "patch_url": "https://github.com/oppia/oppia/pull/5139.patch", + "issue_url": "https://api.github.com/repos/oppia/oppia/issues/5139", + "number": 5139, + "state": "open", + "locked": false, + "title": "WIP Exploration editor Page Object", + "user": { + "login": "testuser7777", + "id": 11153258, + "node_id": "MDQ6VXNlcjExMTUzMjU4", + "avatar_url": "https://avatars2.githubusercontent.com/u/11153258?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/testuser7777", + "html_url": "https://github.com/testuser7777", + "followers_url": "https://api.github.com/users/testuser7777/followers", + "following_url": "https://api.github.com/users/testuser7777/following{/other_user}", + "gists_url": "https://api.github.com/users/testuser7777/gists{/gist_id}", + "starred_url": "https://api.github.com/users/testuser7777/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/testuser7777/subscriptions", + "organizations_url": "https://api.github.com/users/testuser7777/orgs", + "repos_url": "https://api.github.com/users/testuser7777/repos", + "events_url": "https://api.github.com/users/testuser7777/events{/privacy}", + "received_events_url": "https://api.github.com/users/testuser7777/received_events", + "type": "User", + "site_admin": false + }, + "body": "\r\n\r\n## Explanation\r\n\r\nThis PR refactor `editor.js` in various e2e test suite into its own ExplorationEditorPage.\r\n\r\n## Checklist\r\n- [ ] The PR title starts with \"Fix #bugnum: \", followed by a short, clear summary of the changes.\r\n- [ ] The PR explanation includes the words \"Fixes #bugnum: ...\".\r\n- [ ] The linter/Karma presubmit checks have passed.\r\n - These should run automatically, but if not, you can manually trigger them locally using `python scripts/pre_commit_linter.py` and `bash scripts/run_frontend_tests.sh`.\r\n- [ ] The PR is made from a branch that's **not** called \"develop\".\r\n- [ ] The PR follows the [style guide](https://github.com/oppia/oppia/wiki/Coding-style-guide).\r\n- [ ] The PR is assigned to an appropriate reviewer.\r\n - If you're a new contributor, please ask on [Gitter](https://gitter.im/oppia/oppia-chat) for someone to assign a reviewer.\r\n - If you're not sure who the appropriate reviewer is, please assign to the issue's \"owner\" -- see the \"talk-to\" label on the issue.\r\n", + "created_at": "2018-06-22T17:26:11Z", + "updated_at": "2018-06-22T17:26:11Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [ + { + "id": 248679580, + "node_id": "MDU6TGFiZWwyNDg2Nzk1ODA=", + "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20LGTM", + "name": "PR: LGTM", + "color": "009800", + "default": false + }, + { + "id": 971968901, + "node_id": "MDU6TGFiZWw5NzE5Njg5MDE=", + "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20don't%20merge%20-%20HAS%20MERGE%20CONFLICTS", + "name": "PR: don't merge - HAS MERGE CONFLICTS", + "color": "d93f0b", + "default": false + }, + { + "id": 638838928, + "node_id": "MDU6TGFiZWw2Mzg4Mzg5Mjg=", + "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20for%20current%20release", + "name": "PR: for current release", + "color": "FF69B4", + "default": false + }, + { + "id": 638839900, + "node_id": "MDU6TGFiZWw2Mzg4Mzk5MDA=", + "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20released", + "name": "PR: released", + "color": "00FF00", + "default": false + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/oppia/oppia/pulls/5139/commits", + "review_comments_url": "https://api.github.com/repos/oppia/oppia/pulls/5139/comments", + "review_comment_url": "https://api.github.com/repos/oppia/oppia/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/oppia/oppia/issues/5139/comments", + "statuses_url": "https://api.github.com/repos/oppia/oppia/statuses/f4a078d329c1d734c94888bd4c3569b188caa4aa", + "head": { + "label": "testuser7777:ExplorationEditorPage", + "ref": "ExplorationEditorPage", + "sha": "f4a078d329c1d734c94888bd4c3569b188caa4aa", "user": { "login": "testuser7777", "id": 11153258, @@ -35,62 +108,12 @@ "type": "User", "site_admin": false }, - "body": "\r\n\r\n## Explanation\r\n\r\nThis PR refactor `editor.js` in various e2e test suite into its own ExplorationEditorPage.\r\n\r\n## Checklist\r\n- [ ] The PR title starts with \"Fix #bugnum: \", followed by a short, clear summary of the changes.\r\n- [ ] The PR explanation includes the words \"Fixes #bugnum: ...\".\r\n- [ ] The linter/Karma presubmit checks have passed.\r\n - These should run automatically, but if not, you can manually trigger them locally using `python scripts/pre_commit_linter.py` and `bash scripts/run_frontend_tests.sh`.\r\n- [ ] The PR is made from a branch that's **not** called \"develop\".\r\n- [ ] The PR follows the [style guide](https://github.com/oppia/oppia/wiki/Coding-style-guide).\r\n- [ ] The PR is assigned to an appropriate reviewer.\r\n - If you're a new contributor, please ask on [Gitter](https://gitter.im/oppia/oppia-chat) for someone to assign a reviewer.\r\n - If you're not sure who the appropriate reviewer is, please assign to the issue's \"owner\" -- see the \"talk-to\" label on the issue.\r\n", - "created_at": "2018-06-22T17:26:11Z", - "updated_at": "2018-06-22T17:26:11Z", - "closed_at": null, - "merged_at": null, - "merge_commit_sha": null, - "assignee": null, - "assignees": [], - "requested_reviewers": [], - "requested_teams": [], - "labels": [ - { - "id": 248679580, - "node_id": "MDU6TGFiZWwyNDg2Nzk1ODA=", - "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20LGTM", - "name": "PR: LGTM", - "color": "009800", - "default": false - }, - { - "id": 971968901, - "node_id": "MDU6TGFiZWw5NzE5Njg5MDE=", - "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20don't%20merge%20-%20HAS%20MERGE%20CONFLICTS", - "name": "PR: don't merge - HAS MERGE CONFLICTS", - "color": "d93f0b", - "default": false - }, - { - "id": 638838928, - "node_id": "MDU6TGFiZWw2Mzg4Mzg5Mjg=", - "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20for%20current%20release", - "name": "PR: for current release", - "color": "FF69B4", - "default": false - }, - { - "id": 638839900, - "node_id": "MDU6TGFiZWw2Mzg4Mzk5MDA=", - "url": "https://api.github.com/repos/oppia/oppia/labels/PR:%20released", - "name": "PR: released", - "color": "00FF00", - "default": false - } - ], - "milestone": null, - "draft": false, - "commits_url": "https://api.github.com/repos/oppia/oppia/pulls/5139/commits", - "review_comments_url": "https://api.github.com/repos/oppia/oppia/pulls/5139/comments", - "review_comment_url": "https://api.github.com/repos/oppia/oppia/pulls/comments{/number}", - "comments_url": "https://api.github.com/repos/oppia/oppia/issues/5139/comments", - "statuses_url": "https://api.github.com/repos/oppia/oppia/statuses/f4a078d329c1d734c94888bd4c3569b188caa4aa", - "head": { - "label": "testuser7777:ExplorationEditorPage", - "ref": "ExplorationEditorPage", - "sha": "f4a078d329c1d734c94888bd4c3569b188caa4aa", - "user": { + "repo": { + "id": 136071092, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzYwNzEwOTI=", + "name": "oppia", + "full_name": "testuser7777/oppia", + "owner": { "login": "testuser7777", "id": 11153258, "node_id": "MDQ6VXNlcjExMTUzMjU4", @@ -110,111 +133,111 @@ "type": "User", "site_admin": false }, - "repo": { - "id": 136071092, - "node_id": "MDEwOlJlcG9zaXRvcnkxMzYwNzEwOTI=", - "name": "oppia", - "full_name": "testuser7777/oppia", - "owner": { - "login": "testuser7777", - "id": 11153258, - "node_id": "MDQ6VXNlcjExMTUzMjU4", - "avatar_url": "https://avatars2.githubusercontent.com/u/11153258?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/testuser7777", - "html_url": "https://github.com/testuser7777", - "followers_url": "https://api.github.com/users/testuser7777/followers", - "following_url": "https://api.github.com/users/testuser7777/following{/other_user}", - "gists_url": "https://api.github.com/users/testuser7777/gists{/gist_id}", - "starred_url": "https://api.github.com/users/testuser7777/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/testuser7777/subscriptions", - "organizations_url": "https://api.github.com/users/testuser7777/orgs", - "repos_url": "https://api.github.com/users/testuser7777/repos", - "events_url": "https://api.github.com/users/testuser7777/events{/privacy}", - "received_events_url": "https://api.github.com/users/testuser7777/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/testuser7777/oppia", - "description": "Tool for collaboratively building interactive lessons.", - "fork": true, - "url": "https://api.github.com/repos/testuser7777/oppia", - "forks_url": "https://api.github.com/repos/testuser7777/oppia/forks", - "keys_url": "https://api.github.com/repos/testuser7777/oppia/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/testuser7777/oppia/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/testuser7777/oppia/teams", - "hooks_url": "https://api.github.com/repos/testuser7777/oppia/hooks", - "issue_events_url": "https://api.github.com/repos/testuser7777/oppia/issues/events{/number}", - "events_url": "https://api.github.com/repos/testuser7777/oppia/events", - "assignees_url": "https://api.github.com/repos/testuser7777/oppia/assignees{/user}", - "branches_url": "https://api.github.com/repos/testuser7777/oppia/branches{/branch}", - "tags_url": "https://api.github.com/repos/testuser7777/oppia/tags", - "blobs_url": "https://api.github.com/repos/testuser7777/oppia/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/testuser7777/oppia/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/testuser7777/oppia/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/testuser7777/oppia/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/testuser7777/oppia/statuses/{sha}", - "languages_url": "https://api.github.com/repos/testuser7777/oppia/languages", - "stargazers_url": "https://api.github.com/repos/testuser7777/oppia/stargazers", - "contributors_url": "https://api.github.com/repos/testuser7777/oppia/contributors", - "subscribers_url": "https://api.github.com/repos/testuser7777/oppia/subscribers", - "subscription_url": "https://api.github.com/repos/testuser7777/oppia/subscription", - "commits_url": "https://api.github.com/repos/testuser7777/oppia/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/testuser7777/oppia/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/testuser7777/oppia/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/testuser7777/oppia/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/testuser7777/oppia/contents/{+path}", - "compare_url": "https://api.github.com/repos/testuser7777/oppia/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/testuser7777/oppia/merges", - "archive_url": "https://api.github.com/repos/testuser7777/oppia/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/testuser7777/oppia/downloads", - "issues_url": "https://api.github.com/repos/testuser7777/oppia/issues{/number}", - "pulls_url": "https://api.github.com/repos/testuser7777/oppia/pulls{/number}", - "milestones_url": "https://api.github.com/repos/testuser7777/oppia/milestones{/number}", - "notifications_url": "https://api.github.com/repos/testuser7777/oppia/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/testuser7777/oppia/labels{/name}", - "releases_url": "https://api.github.com/repos/testuser7777/oppia/releases{/id}", - "deployments_url": "https://api.github.com/repos/testuser7777/oppia/deployments", - "created_at": "2018-06-04T19:09:54Z", - "updated_at": "2018-06-20T04:11:41Z", - "pushed_at": "2018-06-22T17:21:57Z", - "git_url": "git://github.com/testuser7777/oppia.git", - "ssh_url": "git@github.com:testuser7777/oppia.git", - "clone_url": "https://github.com/testuser7777/oppia.git", - "svn_url": "https://github.com/testuser7777/oppia", - "homepage": "https://www.oppia.org", - "size": 104374, - "stargazers_count": 0, - "watchers_count": 0, - "language": "Python", - "has_issues": false, - "has_projects": true, - "has_downloads": false, - "has_wiki": true, - "has_pages": false, - "forks_count": 0, - "mirror_url": null, - "archived": false, - "open_issues_count": 0, - "license": { - "key": "apache-2.0", - "name": "Apache License 2.0", - "spdx_id": "Apache-2.0", - "url": "https://api.github.com/licenses/apache-2.0", - "node_id": "MDc6TGljZW5zZTI=" - }, - "forks": 0, - "open_issues": 0, - "watchers": 0, - "default_branch": "develop" - } + "private": false, + "html_url": "https://github.com/testuser7777/oppia", + "description": "Tool for collaboratively building interactive lessons.", + "fork": true, + "url": "https://api.github.com/repos/testuser7777/oppia", + "forks_url": "https://api.github.com/repos/testuser7777/oppia/forks", + "keys_url": "https://api.github.com/repos/testuser7777/oppia/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/testuser7777/oppia/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/testuser7777/oppia/teams", + "hooks_url": "https://api.github.com/repos/testuser7777/oppia/hooks", + "issue_events_url": "https://api.github.com/repos/testuser7777/oppia/issues/events{/number}", + "events_url": "https://api.github.com/repos/testuser7777/oppia/events", + "assignees_url": "https://api.github.com/repos/testuser7777/oppia/assignees{/user}", + "branches_url": "https://api.github.com/repos/testuser7777/oppia/branches{/branch}", + "tags_url": "https://api.github.com/repos/testuser7777/oppia/tags", + "blobs_url": "https://api.github.com/repos/testuser7777/oppia/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/testuser7777/oppia/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/testuser7777/oppia/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/testuser7777/oppia/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/testuser7777/oppia/statuses/{sha}", + "languages_url": "https://api.github.com/repos/testuser7777/oppia/languages", + "stargazers_url": "https://api.github.com/repos/testuser7777/oppia/stargazers", + "contributors_url": "https://api.github.com/repos/testuser7777/oppia/contributors", + "subscribers_url": "https://api.github.com/repos/testuser7777/oppia/subscribers", + "subscription_url": "https://api.github.com/repos/testuser7777/oppia/subscription", + "commits_url": "https://api.github.com/repos/testuser7777/oppia/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/testuser7777/oppia/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/testuser7777/oppia/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/testuser7777/oppia/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/testuser7777/oppia/contents/{+path}", + "compare_url": "https://api.github.com/repos/testuser7777/oppia/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/testuser7777/oppia/merges", + "archive_url": "https://api.github.com/repos/testuser7777/oppia/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/testuser7777/oppia/downloads", + "issues_url": "https://api.github.com/repos/testuser7777/oppia/issues{/number}", + "pulls_url": "https://api.github.com/repos/testuser7777/oppia/pulls{/number}", + "milestones_url": "https://api.github.com/repos/testuser7777/oppia/milestones{/number}", + "notifications_url": "https://api.github.com/repos/testuser7777/oppia/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/testuser7777/oppia/labels{/name}", + "releases_url": "https://api.github.com/repos/testuser7777/oppia/releases{/id}", + "deployments_url": "https://api.github.com/repos/testuser7777/oppia/deployments", + "created_at": "2018-06-04T19:09:54Z", + "updated_at": "2018-06-20T04:11:41Z", + "pushed_at": "2018-06-22T17:21:57Z", + "git_url": "git://github.com/testuser7777/oppia.git", + "ssh_url": "git@github.com:testuser7777/oppia.git", + "clone_url": "https://github.com/testuser7777/oppia.git", + "svn_url": "https://github.com/testuser7777/oppia", + "homepage": "https://www.oppia.org", + "size": 104374, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Python", + "has_issues": false, + "has_projects": true, + "has_downloads": false, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 0, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "develop" + } + }, + "base": { + "label": "oppia:develop", + "ref": "develop", + "sha": "e11386f2ae6b6c976ade328070d8cb95fd3f5349", + "user": { + "login": "oppia", + "id": 11620230, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw", + "avatar_url": "https://avatars1.githubusercontent.com/u/11620230?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/oppia", + "html_url": "https://github.com/oppia", + "followers_url": "https://api.github.com/users/oppia/followers", + "following_url": "https://api.github.com/users/oppia/following{/other_user}", + "gists_url": "https://api.github.com/users/oppia/gists{/gist_id}", + "starred_url": "https://api.github.com/users/oppia/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/oppia/subscriptions", + "organizations_url": "https://api.github.com/users/oppia/orgs", + "repos_url": "https://api.github.com/users/oppia/repos", + "events_url": "https://api.github.com/users/oppia/events{/privacy}", + "received_events_url": "https://api.github.com/users/oppia/received_events", + "type": "Organization", + "site_admin": false }, - "base": { - "label": "oppia:develop", - "ref": "develop", - "sha": "e11386f2ae6b6c976ade328070d8cb95fd3f5349", - "user": { + "repo": { + "id": 40687563, + "node_id": "MDEwOlJlcG9zaXRvcnk0MDY4NzU2Mw==", + "name": "oppia", + "full_name": "oppia/oppia", + "owner": { "login": "oppia", "id": 11620230, "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw", @@ -234,287 +257,261 @@ "type": "Organization", "site_admin": false }, - "repo": { - "id": 40687563, - "node_id": "MDEwOlJlcG9zaXRvcnk0MDY4NzU2Mw==", - "name": "oppia", - "full_name": "oppia/oppia", - "owner": { - "login": "oppia", - "id": 11620230, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw", - "avatar_url": "https://avatars1.githubusercontent.com/u/11620230?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/oppia", - "html_url": "https://github.com/oppia", - "followers_url": "https://api.github.com/users/oppia/followers", - "following_url": "https://api.github.com/users/oppia/following{/other_user}", - "gists_url": "https://api.github.com/users/oppia/gists{/gist_id}", - "starred_url": "https://api.github.com/users/oppia/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/oppia/subscriptions", - "organizations_url": "https://api.github.com/users/oppia/orgs", - "repos_url": "https://api.github.com/users/oppia/repos", - "events_url": "https://api.github.com/users/oppia/events{/privacy}", - "received_events_url": "https://api.github.com/users/oppia/received_events", - "type": "Organization", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/oppia/oppia", - "description": "Tool for collaboratively building interactive lessons.", - "fork": false, - "url": "https://api.github.com/repos/oppia/oppia", - "forks_url": "https://api.github.com/repos/oppia/oppia/forks", - "keys_url": "https://api.github.com/repos/oppia/oppia/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/oppia/oppia/teams", - "hooks_url": "https://api.github.com/repos/oppia/oppia/hooks", - "issue_events_url": "https://api.github.com/repos/oppia/oppia/issues/events{/number}", - "events_url": "https://api.github.com/repos/oppia/oppia/events", - "assignees_url": "https://api.github.com/repos/oppia/oppia/assignees{/user}", - "branches_url": "https://api.github.com/repos/oppia/oppia/branches{/branch}", - "tags_url": "https://api.github.com/repos/oppia/oppia/tags", - "blobs_url": "https://api.github.com/repos/oppia/oppia/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/oppia/oppia/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/oppia/oppia/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/oppia/oppia/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/oppia/oppia/statuses/{sha}", - "languages_url": "https://api.github.com/repos/oppia/oppia/languages", - "stargazers_url": "https://api.github.com/repos/oppia/oppia/stargazers", - "contributors_url": "https://api.github.com/repos/oppia/oppia/contributors", - "subscribers_url": "https://api.github.com/repos/oppia/oppia/subscribers", - "subscription_url": "https://api.github.com/repos/oppia/oppia/subscription", - "commits_url": "https://api.github.com/repos/oppia/oppia/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/oppia/oppia/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/oppia/oppia/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/oppia/oppia/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/oppia/oppia/contents/{+path}", - "compare_url": "https://api.github.com/repos/oppia/oppia/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/oppia/oppia/merges", - "archive_url": "https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/oppia/oppia/downloads", - "issues_url": "https://api.github.com/repos/oppia/oppia/issues{/number}", - "pulls_url": "https://api.github.com/repos/oppia/oppia/pulls{/number}", - "milestones_url": "https://api.github.com/repos/oppia/oppia/milestones{/number}", - "notifications_url": "https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/oppia/oppia/labels{/name}", - "releases_url": "https://api.github.com/repos/oppia/oppia/releases{/id}", - "deployments_url": "https://api.github.com/repos/oppia/oppia/deployments", - "created_at": "2015-08-14T00:16:14Z", - "updated_at": "2018-06-22T16:09:38Z", - "pushed_at": "2018-06-22T15:47:37Z", - "git_url": "git://github.com/oppia/oppia.git", - "ssh_url": "git@github.com:oppia/oppia.git", - "clone_url": "https://github.com/oppia/oppia.git", - "svn_url": "https://github.com/oppia/oppia", - "homepage": "https://www.oppia.org", - "size": 104434, - "stargazers_count": 676, - "watchers_count": 676, - "language": "Python", - "has_issues": true, - "has_projects": true, - "has_downloads": false, - "has_wiki": true, - "has_pages": false, - "forks_count": 648, - "mirror_url": null, - "archived": false, - "open_issues_count": 327, - "license": { - "key": "apache-2.0", - "name": "Apache License 2.0", - "spdx_id": "Apache-2.0", - "url": "https://api.github.com/licenses/apache-2.0", - "node_id": "MDc6TGljZW5zZTI=" - }, - "forks": 648, - "open_issues": 327, - "watchers": 676, - "default_branch": "develop" - } - }, - "_links": { - "self": { - "href": "https://api.github.com/repos/oppia/oppia/pulls/5139" - }, - "html": { - "href": "https://github.com/oppia/oppia/pull/5139" - }, - "issue": { - "href": "https://api.github.com/repos/oppia/oppia/issues/5139" + "private": false, + "html_url": "https://github.com/oppia/oppia", + "description": "Tool for collaboratively building interactive lessons.", + "fork": false, + "url": "https://api.github.com/repos/oppia/oppia", + "forks_url": "https://api.github.com/repos/oppia/oppia/forks", + "keys_url": "https://api.github.com/repos/oppia/oppia/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/oppia/oppia/teams", + "hooks_url": "https://api.github.com/repos/oppia/oppia/hooks", + "issue_events_url": "https://api.github.com/repos/oppia/oppia/issues/events{/number}", + "events_url": "https://api.github.com/repos/oppia/oppia/events", + "assignees_url": "https://api.github.com/repos/oppia/oppia/assignees{/user}", + "branches_url": "https://api.github.com/repos/oppia/oppia/branches{/branch}", + "tags_url": "https://api.github.com/repos/oppia/oppia/tags", + "blobs_url": "https://api.github.com/repos/oppia/oppia/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/oppia/oppia/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/oppia/oppia/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/oppia/oppia/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/oppia/oppia/statuses/{sha}", + "languages_url": "https://api.github.com/repos/oppia/oppia/languages", + "stargazers_url": "https://api.github.com/repos/oppia/oppia/stargazers", + "contributors_url": "https://api.github.com/repos/oppia/oppia/contributors", + "subscribers_url": "https://api.github.com/repos/oppia/oppia/subscribers", + "subscription_url": "https://api.github.com/repos/oppia/oppia/subscription", + "commits_url": "https://api.github.com/repos/oppia/oppia/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/oppia/oppia/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/oppia/oppia/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/oppia/oppia/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/oppia/oppia/contents/{+path}", + "compare_url": "https://api.github.com/repos/oppia/oppia/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/oppia/oppia/merges", + "archive_url": "https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/oppia/oppia/downloads", + "issues_url": "https://api.github.com/repos/oppia/oppia/issues{/number}", + "pulls_url": "https://api.github.com/repos/oppia/oppia/pulls{/number}", + "milestones_url": "https://api.github.com/repos/oppia/oppia/milestones{/number}", + "notifications_url": "https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/oppia/oppia/labels{/name}", + "releases_url": "https://api.github.com/repos/oppia/oppia/releases{/id}", + "deployments_url": "https://api.github.com/repos/oppia/oppia/deployments", + "created_at": "2015-08-14T00:16:14Z", + "updated_at": "2018-06-22T16:09:38Z", + "pushed_at": "2018-06-22T15:47:37Z", + "git_url": "git://github.com/oppia/oppia.git", + "ssh_url": "git@github.com:oppia/oppia.git", + "clone_url": "https://github.com/oppia/oppia.git", + "svn_url": "https://github.com/oppia/oppia", + "homepage": "https://www.oppia.org", + "size": 104434, + "stargazers_count": 676, + "watchers_count": 676, + "language": "Python", + "has_issues": true, + "has_projects": true, + "has_downloads": false, + "has_wiki": true, + "has_pages": false, + "forks_count": 648, + "mirror_url": null, + "archived": false, + "open_issues_count": 327, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" }, - "comments": { - "href": "https://api.github.com/repos/oppia/oppia/issues/5139/comments" - }, - "review_comments": { - "href": "https://api.github.com/repos/oppia/oppia/pulls/5139/comments" - }, - "review_comment": { - "href": "https://api.github.com/repos/oppia/oppia/pulls/comments{/number}" - }, - "commits": { - "href": "https://api.github.com/repos/oppia/oppia/pulls/5139/commits" - }, - "statuses": { - "href": "https://api.github.com/repos/oppia/oppia/statuses/f4a078d329c1d734c94888bd4c3569b188caa4aa" - } - }, - "author_association": "COLLABORATOR", - "merged": false, - "mergeable": null, - "rebaseable": null, - "mergeable_state": "unknown", - "merged_by": null, - "comments": 0, - "review_comments": 0, - "maintainer_can_modify": true, - "commits": 2, - "additions": 1001, - "deletions": 130, - "changed_files": 2 - }, - "changes": { - "title": { - "from": "Testing probot upgrade wip" + "forks": 648, + "open_issues": 327, + "watchers": 676, + "default_branch": "develop" } }, - "repository": { - "id": 40687563, - "node_id": "MDEwOlJlcG9zaXRvcnk0MDY4NzU2Mw==", - "name": "oppia", - "full_name": "oppia/oppia", - "owner": { - "login": "oppia", - "id": 11620230, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw", - "avatar_url": "https://avatars1.githubusercontent.com/u/11620230?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/oppia", - "html_url": "https://github.com/oppia", - "followers_url": "https://api.github.com/users/oppia/followers", - "following_url": "https://api.github.com/users/oppia/following{/other_user}", - "gists_url": "https://api.github.com/users/oppia/gists{/gist_id}", - "starred_url": "https://api.github.com/users/oppia/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/oppia/subscriptions", - "organizations_url": "https://api.github.com/users/oppia/orgs", - "repos_url": "https://api.github.com/users/oppia/repos", - "events_url": "https://api.github.com/users/oppia/events{/privacy}", - "received_events_url": "https://api.github.com/users/oppia/received_events", - "type": "Organization", - "site_admin": false + "_links": { + "self": { + "href": "https://api.github.com/repos/oppia/oppia/pulls/5139" + }, + "html": { + "href": "https://github.com/oppia/oppia/pull/5139" }, - "private": false, - "html_url": "https://github.com/oppia/oppia", - "description": "Tool for collaboratively building interactive lessons.", - "fork": false, - "url": "https://api.github.com/repos/oppia/oppia", - "forks_url": "https://api.github.com/repos/oppia/oppia/forks", - "keys_url": "https://api.github.com/repos/oppia/oppia/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/oppia/oppia/teams", - "hooks_url": "https://api.github.com/repos/oppia/oppia/hooks", - "issue_events_url": "https://api.github.com/repos/oppia/oppia/issues/events{/number}", - "events_url": "https://api.github.com/repos/oppia/oppia/events", - "assignees_url": "https://api.github.com/repos/oppia/oppia/assignees{/user}", - "branches_url": "https://api.github.com/repos/oppia/oppia/branches{/branch}", - "tags_url": "https://api.github.com/repos/oppia/oppia/tags", - "blobs_url": "https://api.github.com/repos/oppia/oppia/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/oppia/oppia/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/oppia/oppia/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/oppia/oppia/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/oppia/oppia/statuses/{sha}", - "languages_url": "https://api.github.com/repos/oppia/oppia/languages", - "stargazers_url": "https://api.github.com/repos/oppia/oppia/stargazers", - "contributors_url": "https://api.github.com/repos/oppia/oppia/contributors", - "subscribers_url": "https://api.github.com/repos/oppia/oppia/subscribers", - "subscription_url": "https://api.github.com/repos/oppia/oppia/subscription", - "commits_url": "https://api.github.com/repos/oppia/oppia/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/oppia/oppia/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/oppia/oppia/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/oppia/oppia/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/oppia/oppia/contents/{+path}", - "compare_url": "https://api.github.com/repos/oppia/oppia/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/oppia/oppia/merges", - "archive_url": "https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/oppia/oppia/downloads", - "issues_url": "https://api.github.com/repos/oppia/oppia/issues{/number}", - "pulls_url": "https://api.github.com/repos/oppia/oppia/pulls{/number}", - "milestones_url": "https://api.github.com/repos/oppia/oppia/milestones{/number}", - "notifications_url": "https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/oppia/oppia/labels{/name}", - "releases_url": "https://api.github.com/repos/oppia/oppia/releases{/id}", - "deployments_url": "https://api.github.com/repos/oppia/oppia/deployments", - "created_at": "2015-08-14T00:16:14Z", - "updated_at": "2018-06-22T16:09:38Z", - "pushed_at": "2018-06-22T15:47:37Z", - "git_url": "git://github.com/oppia/oppia.git", - "ssh_url": "git@github.com:oppia/oppia.git", - "clone_url": "https://github.com/oppia/oppia.git", - "svn_url": "https://github.com/oppia/oppia", - "homepage": "https://www.oppia.org", - "size": 104434, - "stargazers_count": 676, - "watchers_count": 676, - "language": "Python", - "has_issues": true, - "has_projects": true, - "has_downloads": false, - "has_wiki": true, - "has_pages": false, - "forks_count": 648, - "mirror_url": null, - "archived": false, - "open_issues_count": 327, - "license": { - "key": "apache-2.0", - "name": "Apache License 2.0", - "spdx_id": "Apache-2.0", - "url": "https://api.github.com/licenses/apache-2.0", - "node_id": "MDc6TGljZW5zZTI=" + "issue": { + "href": "https://api.github.com/repos/oppia/oppia/issues/5139" }, - "forks": 648, - "open_issues": 327, - "watchers": 676, - "default_branch": "develop" + "comments": { + "href": "https://api.github.com/repos/oppia/oppia/issues/5139/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/oppia/oppia/pulls/5139/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/oppia/oppia/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/oppia/oppia/pulls/5139/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/oppia/oppia/statuses/f4a078d329c1d734c94888bd4c3569b188caa4aa" + } }, - "organization": { + "author_association": "COLLABORATOR", + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": true, + "commits": 2, + "additions": 1001, + "deletions": 130, + "changed_files": 2 + }, + "changes": { + "title": { + "from": "Testing probot upgrade wip" + } + }, + "repository": { + "id": 40687563, + "node_id": "MDEwOlJlcG9zaXRvcnk0MDY4NzU2Mw==", + "name": "oppia", + "full_name": "oppia/oppia", + "owner": { "login": "oppia", "id": 11620230, "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw", - "url": "https://api.github.com/orgs/oppia", - "repos_url": "https://api.github.com/orgs/oppia/repos", - "events_url": "https://api.github.com/orgs/oppia/events", - "hooks_url": "https://api.github.com/orgs/oppia/hooks", - "issues_url": "https://api.github.com/orgs/oppia/issues", - "members_url": "https://api.github.com/orgs/oppia/members{/member}", - "public_members_url": "https://api.github.com/orgs/oppia/public_members{/member}", "avatar_url": "https://avatars1.githubusercontent.com/u/11620230?v=4", - "description": "" - }, - "sender": { - "login": "testuser7777", - "id": 11153258, - "node_id": "MDQ6VXNlcjExMTUzMjU4", - "avatar_url": "https://avatars2.githubusercontent.com/u/11153258?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/testuser7777", - "html_url": "https://github.com/testuser7777", - "followers_url": "https://api.github.com/users/testuser7777/followers", - "following_url": "https://api.github.com/users/testuser7777/following{/other_user}", - "gists_url": "https://api.github.com/users/testuser7777/gists{/gist_id}", - "starred_url": "https://api.github.com/users/testuser7777/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/testuser7777/subscriptions", - "organizations_url": "https://api.github.com/users/testuser7777/orgs", - "repos_url": "https://api.github.com/users/testuser7777/repos", - "events_url": "https://api.github.com/users/testuser7777/events{/privacy}", - "received_events_url": "https://api.github.com/users/testuser7777/received_events", - "type": "User", + "url": "https://api.github.com/users/oppia", + "html_url": "https://github.com/oppia", + "followers_url": "https://api.github.com/users/oppia/followers", + "following_url": "https://api.github.com/users/oppia/following{/other_user}", + "gists_url": "https://api.github.com/users/oppia/gists{/gist_id}", + "starred_url": "https://api.github.com/users/oppia/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/oppia/subscriptions", + "organizations_url": "https://api.github.com/users/oppia/orgs", + "repos_url": "https://api.github.com/users/oppia/repos", + "events_url": "https://api.github.com/users/oppia/events{/privacy}", + "received_events_url": "https://api.github.com/users/oppia/received_events", + "type": "Organization", "site_admin": false }, - "installation": { - "id": 6909030, - "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNjkwOTAzMA==" - } + "private": false, + "html_url": "https://github.com/oppia/oppia", + "description": "Tool for collaboratively building interactive lessons.", + "fork": false, + "url": "https://api.github.com/repos/oppia/oppia", + "forks_url": "https://api.github.com/repos/oppia/oppia/forks", + "keys_url": "https://api.github.com/repos/oppia/oppia/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/oppia/oppia/teams", + "hooks_url": "https://api.github.com/repos/oppia/oppia/hooks", + "issue_events_url": "https://api.github.com/repos/oppia/oppia/issues/events{/number}", + "events_url": "https://api.github.com/repos/oppia/oppia/events", + "assignees_url": "https://api.github.com/repos/oppia/oppia/assignees{/user}", + "branches_url": "https://api.github.com/repos/oppia/oppia/branches{/branch}", + "tags_url": "https://api.github.com/repos/oppia/oppia/tags", + "blobs_url": "https://api.github.com/repos/oppia/oppia/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/oppia/oppia/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/oppia/oppia/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/oppia/oppia/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/oppia/oppia/statuses/{sha}", + "languages_url": "https://api.github.com/repos/oppia/oppia/languages", + "stargazers_url": "https://api.github.com/repos/oppia/oppia/stargazers", + "contributors_url": "https://api.github.com/repos/oppia/oppia/contributors", + "subscribers_url": "https://api.github.com/repos/oppia/oppia/subscribers", + "subscription_url": "https://api.github.com/repos/oppia/oppia/subscription", + "commits_url": "https://api.github.com/repos/oppia/oppia/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/oppia/oppia/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/oppia/oppia/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/oppia/oppia/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/oppia/oppia/contents/{+path}", + "compare_url": "https://api.github.com/repos/oppia/oppia/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/oppia/oppia/merges", + "archive_url": "https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/oppia/oppia/downloads", + "issues_url": "https://api.github.com/repos/oppia/oppia/issues{/number}", + "pulls_url": "https://api.github.com/repos/oppia/oppia/pulls{/number}", + "milestones_url": "https://api.github.com/repos/oppia/oppia/milestones{/number}", + "notifications_url": "https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/oppia/oppia/labels{/name}", + "releases_url": "https://api.github.com/repos/oppia/oppia/releases{/id}", + "deployments_url": "https://api.github.com/repos/oppia/oppia/deployments", + "created_at": "2015-08-14T00:16:14Z", + "updated_at": "2018-06-22T16:09:38Z", + "pushed_at": "2018-06-22T15:47:37Z", + "git_url": "git://github.com/oppia/oppia.git", + "ssh_url": "git@github.com:oppia/oppia.git", + "clone_url": "https://github.com/oppia/oppia.git", + "svn_url": "https://github.com/oppia/oppia", + "homepage": "https://www.oppia.org", + "size": 104434, + "stargazers_count": 676, + "watchers_count": 676, + "language": "Python", + "has_issues": true, + "has_projects": true, + "has_downloads": false, + "has_wiki": true, + "has_pages": false, + "forks_count": 648, + "mirror_url": null, + "archived": false, + "open_issues_count": 327, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "forks": 648, + "open_issues": 327, + "watchers": 676, + "default_branch": "develop" + }, + "organization": { + "login": "oppia", + "id": 11620230, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw", + "url": "https://api.github.com/orgs/oppia", + "repos_url": "https://api.github.com/orgs/oppia/repos", + "events_url": "https://api.github.com/orgs/oppia/events", + "hooks_url": "https://api.github.com/orgs/oppia/hooks", + "issues_url": "https://api.github.com/orgs/oppia/issues", + "members_url": "https://api.github.com/orgs/oppia/members{/member}", + "public_members_url": "https://api.github.com/orgs/oppia/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/11620230?v=4", + "description": "" + }, + "sender": { + "login": "testuser7777", + "id": 11153258, + "node_id": "MDQ6VXNlcjExMTUzMjU4", + "avatar_url": "https://avatars2.githubusercontent.com/u/11153258?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/testuser7777", + "html_url": "https://github.com/testuser7777", + "followers_url": "https://api.github.com/users/testuser7777/followers", + "following_url": "https://api.github.com/users/testuser7777/following{/other_user}", + "gists_url": "https://api.github.com/users/testuser7777/gists{/gist_id}", + "starred_url": "https://api.github.com/users/testuser7777/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/testuser7777/subscriptions", + "organizations_url": "https://api.github.com/users/testuser7777/orgs", + "repos_url": "https://api.github.com/users/testuser7777/repos", + "events_url": "https://api.github.com/users/testuser7777/events{/privacy}", + "received_events_url": "https://api.github.com/users/testuser7777/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 6909030, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNjkwOTAzMA==" } } diff --git a/index.js b/index.js index 56852404..746ddf45 100644 --- a/index.js +++ b/index.js @@ -22,7 +22,6 @@ const apiForSheetsModule = require('./lib/apiForSheets'); const checkMergeConflictsModule = require('./lib/checkMergeConflicts'); const checkPullRequestLabelsModule = require('./lib/checkPullRequestLabels'); const checkPullRequestBranchModule = require('./lib/checkPullRequestBranch'); -const checkWipModule = require('./lib/checkWipDraftPR'); const checkPullRequestJobModule = require('./lib/checkPullRequestJob'); const checkCronJobModule = require('./lib/checkNewCronJobs'); const checkPullRequestTemplateModule = require( @@ -73,9 +72,6 @@ const runChecks = async (context, checkEvent) => { case constants.branchCheck: callable.push(checkPullRequestBranchModule.checkBranch(context)); break; - case constants.wipCheck: - callable.push(checkWipModule.checkWIP(context)); - break; case constants.assigneeCheck: callable.push(checkPullRequestLabelsModule.checkAssignee(context)); break; @@ -269,18 +265,6 @@ module.exports = (oppiabot) => { } }); - oppiabot.on('pull_request.edited', async (context) => { - if ( - checkWhitelistedAccounts(context) && - context.payload.pull_request.state === 'open' && - checkAuthor(context) - ) { - // eslint-disable-next-line no-console - console.log('A PR HAS BEEN EDITED...'); - await runChecks(context, constants.editEvent); - } - }); - oppiabot.on('push', async (context) => { if (checkWhitelistedAccounts(context)) { // eslint-disable-next-line no-console diff --git a/spec/apiForSheetsSpec.js b/spec/apiForSheetsSpec.js index c5f284e8..814d6d42 100644 --- a/spec/apiForSheetsSpec.js +++ b/spec/apiForSheetsSpec.js @@ -20,7 +20,6 @@ const constants = require('../constants'); const apiForSheetsModule = require('../lib/apiForSheets'); const checkPullRequestLabelsModule = require('../lib/checkPullRequestLabels'); const checkPullRequestBranchModule = require('../lib/checkPullRequestBranch'); -const checkWipModule = require('../lib/checkWipDraftPR'); const scheduler = require('../lib/scheduler'); const pullRequestPayload = JSON.parse( JSON.stringify(require('../fixtures/pullRequestPayload.json'))); @@ -57,7 +56,6 @@ describe('Api For Sheets Module', () => { spyOn(checkPullRequestLabelsModule, 'checkChangelogLabel').and.callFake( () => { }); spyOn(checkPullRequestBranchModule, 'checkBranch').and.callFake(() => { }); - spyOn(checkWipModule, 'checkWIP').and.callFake(() => { }); spyOn(checkCriticalPullRequestModule, 'checkIfPRAffectsDatastoreLayer') .and.callFake(() => { }); spyOn(checkPullRequestTemplateModule, 'checkTemplate') @@ -130,7 +128,6 @@ describe('Api For Sheets Module', () => { expect( checkPullRequestLabelsModule.checkChangelogLabel).toHaveBeenCalled(); expect(checkPullRequestBranchModule.checkBranch).toHaveBeenCalled(); - expect(checkWipModule.checkWIP).toHaveBeenCalled(); expect(checkPullRequestJobModule.checkForNewJob).toHaveBeenCalled(); }); @@ -328,7 +325,6 @@ describe('Api For Sheets Module', () => { checkPullRequestLabelsModule.checkChangelogLabel ).not.toHaveBeenCalled(); expect(checkPullRequestBranchModule.checkBranch).not.toHaveBeenCalled(); - expect(checkWipModule.checkWIP).not.toHaveBeenCalled(); }); it('should be called for the given payload', () => { @@ -399,7 +395,6 @@ describe('Api For Sheets Module', () => { checkPullRequestLabelsModule.checkChangelogLabel ).not.toHaveBeenCalled(); expect(checkPullRequestBranchModule.checkBranch).not.toHaveBeenCalled(); - expect(checkWipModule.checkWIP).not.toHaveBeenCalled(); expect(apiForSheetsModule.checkClaStatus).not.toHaveBeenCalled(); expect(checkPullRequestJobModule.checkForNewJob).not.toHaveBeenCalled(); }); @@ -421,7 +416,6 @@ describe('Api For Sheets Module', () => { checkPullRequestLabelsModule.checkChangelogLabel ).not.toHaveBeenCalled(); expect(checkPullRequestBranchModule.checkBranch).not.toHaveBeenCalled(); - expect(checkWipModule.checkWIP).not.toHaveBeenCalled(); expect(apiForSheetsModule.checkClaStatus).not.toHaveBeenCalled(); expect(checkPullRequestJobModule.checkForNewJob).not.toHaveBeenCalled(); }); diff --git a/spec/checkCriticalPullRequestSpec.js b/spec/checkCriticalPullRequestSpec.js index dca66c40..b39dbb57 100644 --- a/spec/checkCriticalPullRequestSpec.js +++ b/spec/checkCriticalPullRequestSpec.js @@ -25,7 +25,6 @@ const checkCronJobModule = require('../lib/checkNewCronJobs'); const apiForSheetsModule = require('../lib/apiForSheets'); const checkPullRequestLabelsModule = require('../lib/checkPullRequestLabels'); const checkPullRequestBranchModule = require('../lib/checkPullRequestBranch'); -const checkWIPModule = require('../lib/checkWipDraftPR'); const checkCriticalPullRequestModule = require('../lib/checkCriticalPullRequest'); const checkPullRequestTemplateModule = @@ -200,7 +199,6 @@ describe('Critical Pull Request Spec', () => { 'checkChangelogLabel' ).and.callFake(() => { }); spyOn(checkPullRequestBranchModule, 'checkBranch').and.callFake(() => { }); - spyOn(checkWIPModule, 'checkWIP').and.callFake(() => { }); spyOn( checkPullRequestTemplateModule, 'checkTemplate' ).and.callFake(() => { }); diff --git a/spec/checkNewCronJobSpec.js b/spec/checkNewCronJobSpec.js index b1b08514..32b91e19 100644 --- a/spec/checkNewCronJobSpec.js +++ b/spec/checkNewCronJobSpec.js @@ -22,7 +22,6 @@ const checkPullRequestJobModule = require('../lib/checkPullRequestJob'); const apiForSheetsModule = require('../lib/apiForSheets'); const checkPullRequestLabelsModule = require('../lib/checkPullRequestLabels'); const checkPullRequestBranchModule = require('../lib/checkPullRequestBranch'); -const checkWIPModule = require('../lib/checkWipDraftPR'); const checkCriticalPullRequestModule = require('../lib/checkCriticalPullRequest'); const checkPullRequestTemplateModule = @@ -210,7 +209,6 @@ describe('Cron Job Spec', () => { checkCriticalPullRequestModule, 'checkIfPRAffectsDatastoreLayer' ).and.callFake(() => { }); spyOn(checkPullRequestBranchModule, 'checkBranch').and.callFake(() => { }); - spyOn(checkWIPModule, 'checkWIP').and.callFake(() => { }); spyOn( checkPullRequestTemplateModule, 'checkTemplate' ).and.callFake(() => { }); diff --git a/spec/checkPullRequestBranchSpec.js b/spec/checkPullRequestBranchSpec.js index 9ba4f842..2bcdc959 100644 --- a/spec/checkPullRequestBranchSpec.js +++ b/spec/checkPullRequestBranchSpec.js @@ -16,7 +16,6 @@ require('dotenv').config(); const { createProbot } = require('probot'); // The plugin refers to the actual app in index.js. const oppiaBot = require('../index'); -const checkWipDraftPRModule = require('../lib/checkWipDraftPR'); const scheduler = require('../lib/scheduler'); const pullRequestPayload = require('../fixtures/pullRequestPayload.json'); const apiForSheetsModule = require('../lib/apiForSheets'); @@ -54,8 +53,6 @@ describe('Pull Request Branch Check', () => { checkPullRequestLabelsModule, 'checkChangelogLabel' ).and.callFake(() => { }); - spyOn(checkWipDraftPRModule, 'checkWIP') - .and.callFake(() => { }); spyOn(checkPullRequestJobModule, 'checkForNewJob') .and.callFake(() => { }); spyOn(checkCriticalPullRequestModule, 'checkIfPRAffectsDatastoreLayer') diff --git a/spec/checkPullRequestJobSpec.js b/spec/checkPullRequestJobSpec.js index f312181b..2854cb77 100644 --- a/spec/checkPullRequestJobSpec.js +++ b/spec/checkPullRequestJobSpec.js @@ -20,7 +20,6 @@ const checkPullRequestJobModule = require('../lib/checkPullRequestJob'); const apiForSheetsModule = require('../lib/apiForSheets'); const checkPullRequestLabelsModule = require('../lib/checkPullRequestLabels'); const checkPullRequestBranchModule = require('../lib/checkPullRequestBranch'); -const checkWIPModule = require('../lib/checkWipDraftPR'); const checkCriticalPullRequestModule = require('../lib/checkCriticalPullRequest'); const checkPullRequestTemplateModule = @@ -462,7 +461,6 @@ describe('Pull Request Job Spec', () => { ).and.callFake(() => { }); spyOn(checkPullRequestBranchModule, 'checkBranch').and.callFake(() => { }); spyOn(checkCronJobModule, 'checkForNewCronJob').and.callFake(() => { }); - spyOn(checkWIPModule, 'checkWIP').and.callFake(() => { }); spyOn( checkPullRequestTemplateModule, 'checkTemplate' ).and.callFake(() => { }); diff --git a/spec/checkPullRequestTemplateSpec.js b/spec/checkPullRequestTemplateSpec.js index 05e97275..8ce0c3d1 100644 --- a/spec/checkPullRequestTemplateSpec.js +++ b/spec/checkPullRequestTemplateSpec.js @@ -25,7 +25,6 @@ const checkCronJobModule = require('../lib/checkNewCronJobs'); const apiForSheetsModule = require('../lib/apiForSheets'); const checkPullRequestLabelsModule = require('../lib/checkPullRequestLabels'); const checkPullRequestBranchModule = require('../lib/checkPullRequestBranch'); -const checkWIPModule = require('../lib/checkWipDraftPR'); const checkCriticalPullRequestModule = require('../lib/checkCriticalPullRequest'); const newCodeOwnerModule = require('../lib/checkForNewCodeowner'); @@ -302,7 +301,6 @@ describe('Pull Request Template', () => { 'checkIfPRAffectsDatastoreLayer' ).and.callFake(() => { }); spyOn(checkPullRequestBranchModule, 'checkBranch').and.callFake(() => { }); - spyOn(checkWIPModule, 'checkWIP').and.callFake(() => { }); spyOn(checkPullRequestTemplateModule, 'checkTemplate').and.callThrough(); spyOn(newCodeOwnerModule, 'checkForNewCodeowner').and.callFake(() => { }); }); diff --git a/spec/checkWipDraftPRSpec.js b/spec/checkWipDraftPRSpec.js index b1b5aab8..22020805 100644 --- a/spec/checkWipDraftPRSpec.js +++ b/spec/checkWipDraftPRSpec.js @@ -13,85 +13,56 @@ // limitations under the License. require('dotenv').config(); -const { createProbot } = require('probot'); -// The plugin refers to the actual app in index.js. -const oppiaBot = require('../index'); -const checkWipDraftPRModule = require('../lib/checkWipDraftPR'); -const scheduler = require('../lib/scheduler'); +const github = require('@actions/github'); +const core = require('@actions/core'); +const checkWipDraftPRModule = require( + '../actions/src/pull_requests/checkWipDraftPR'); const pullRequestEditedPayload = require('../fixtures/pullRequest.edited.json'); -const apiForSheetsModule = require('../lib/apiForSheets'); -const checkPullRequestLabelsModule = require('../lib/checkPullRequestLabels'); -const checkPullRequestJobModule = require('../lib/checkPullRequestJob'); -const checkCronJobModule = require('../lib/checkNewCronJobs'); -const checkCriticalPullRequestModule = - require('../lib/checkCriticalPullRequest'); -const checkPullRequestTemplateModule = - require('../lib/checkPullRequestTemplate'); -const newCodeOwnerModule = require('../lib/checkForNewCodeowner'); - -describe('Oppiabot\'s', () => { - /** - * @type {import('probot').Probot} robot - */ - let robot; +const dispatcher = require('../actions/src/dispatcher'); +describe("Oppiabot's", () => { /** - * @type {import('probot').Octokit} github + * @type {import('@actions/github').GitHub} octokit */ - let github; + let octokit; - /** - * @type {import('probot').Application} app - */ - let app; - - beforeEach((done) => { - spyOn(scheduler, 'createScheduler').and.callFake(() => { }); - - // Spy on other modules that will be triggered by the payload. - spyOn(apiForSheetsModule, 'checkClaStatus').and.callFake(() => { }); - spyOn( - checkPullRequestLabelsModule, 'checkChangelogLabel' - ).and.callFake(() => { }); - spyOn(checkPullRequestJobModule, 'checkForNewJob').and.callFake(() => { }); - spyOn(checkCronJobModule, 'checkForNewCronJob').and.callFake(() => { }); - spyOn(checkCriticalPullRequestModule, 'checkIfPRAffectsDatastoreLayer' - ).and.callFake(() => { }); - spyOn(checkPullRequestTemplateModule, 'checkTemplate' - ).and.callFake(() => { }); - spyOn(newCodeOwnerModule, 'checkForNewCodeowner').and.callFake(() => { }); - - github = { + beforeEach(async () => { + github.context.eventName = 'pull_request'; + github.context.payload = pullRequestEditedPayload; + github.context.pull_request = pullRequestEditedPayload.pull_request; + + octokit = { issues: { createComment: jasmine.createSpy('createComment').and.resolveTo({}), addAssignees: jasmine.createSpy('addAssignees').and.resolveTo({}), - } + }, }; - robot = createProbot({ - id: 1, - cert: 'test', - githubToken: 'test', - }); + spyOn(core, 'getInput').and.returnValue('sample-token'); - app = robot.load(oppiaBot); - spyOn(app, 'auth').and.resolveTo(github); + spyOnProperty(github.context, 'repo').and.returnValue({ + owner: pullRequestEditedPayload.repository.owner.login, + repo: pullRequestEditedPayload.repository.name, + }); - done(); + // Mock GitHub API. + Object.setPrototypeOf(github.GitHub, function () { + return octokit; + }); + spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); }); describe('WIP PRs without skip prefix', () => { - beforeEach((done) => { - github.git = { + beforeEach(async () => { + octokit.git = { getCommit: jasmine.createSpy('getCommit').and.resolveTo({ data: { - message: 'commit without skip prefix' - } - }) + message: 'commit without skip prefix', + }, + }), }; - spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); - robot.receive(pullRequestEditedPayload); - done(); + + await dispatcher.dispatch('pull_request', 'edited'); }); it('calls checkWIP function', () => { @@ -103,64 +74,66 @@ describe('Oppiabot\'s', () => { }); it('calls get commit', () => { - expect(github.git.getCommit).toHaveBeenCalled(); - expect(github.git.getCommit).toHaveBeenCalledTimes(1); - expect(github.git.getCommit).toHaveBeenCalledWith({ - owner: pullRequestEditedPayload.payload.repository.owner.login, - repo: pullRequestEditedPayload.payload.repository.name, - commit_sha: pullRequestEditedPayload.payload.pull_request.head.sha + expect(octokit.git.getCommit).toHaveBeenCalled(); + expect(octokit.git.getCommit).toHaveBeenCalledTimes(1); + expect(octokit.git.getCommit).toHaveBeenCalledWith({ + owner: pullRequestEditedPayload.repository.owner.login, + repo: pullRequestEditedPayload.repository.name, + commit_sha: pullRequestEditedPayload.pull_request.head.sha, }); }); it('assigns PR author', () => { - expect(github.issues.addAssignees).toHaveBeenCalled(); + expect(octokit.issues.addAssignees).toHaveBeenCalled(); const params = { - repo: pullRequestEditedPayload.payload.repository.name, - owner: pullRequestEditedPayload.payload.repository.owner.login, - issue_number: pullRequestEditedPayload.payload.pull_request.number, + repo: pullRequestEditedPayload.repository.name, + owner: pullRequestEditedPayload.repository.owner.login, + issue_number: pullRequestEditedPayload.pull_request.number, assignees: ['testuser7777'], }; - expect(github.issues.addAssignees).toHaveBeenCalledWith(params); + expect(octokit.issues.addAssignees).toHaveBeenCalledWith(params); }); it('creates comment for WIP PRs', () => { - expect(github.issues.createComment).toHaveBeenCalled(); - expect(github.issues.createComment).toHaveBeenCalledTimes(1); + expect(octokit.issues.createComment).toHaveBeenCalled(); + expect(octokit.issues.createComment).toHaveBeenCalledTimes(1); // Comment on Pull Request. - const link = ( - 'here'.link( - 'https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia' + - '#wip--draft-pull-requests') + const link = 'here'.link( + 'https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia' + + '#wip--draft-pull-requests' ); - const author = pullRequestEditedPayload.payload.pull_request.user.login; - const commentBody = ( - 'Hi @' + author + ', when creating WIP/Draft PRs, ensure that ' + + const author = pullRequestEditedPayload.pull_request.user.login; + const commentBody = + 'Hi @' + + author + + ', when creating WIP/Draft PRs, ensure that ' + 'your commit messages are prefixed with **[ci skip]** or ' + '**[skip ci]** to prevent CI checks from running. ' + - 'You can learn more about it ' + link + '.'); - - expect(github.issues.createComment).toHaveBeenCalledWith({ - issue_number: pullRequestEditedPayload.payload.pull_request.number, - owner: pullRequestEditedPayload.payload.repository.owner.login, - repo: pullRequestEditedPayload.payload.repository.name, - body: commentBody + 'You can learn more about it ' + + link + + '.'; + + expect(octokit.issues.createComment).toHaveBeenCalledWith({ + issue_number: pullRequestEditedPayload.pull_request.number, + owner: pullRequestEditedPayload.repository.owner.login, + repo: pullRequestEditedPayload.repository.name, + body: commentBody, }); }); }); describe('WIP PRs with skip prefix', () => { - beforeEach((done) => { - github.git = { + beforeEach(async () => { + octokit.git = { getCommit: jasmine.createSpy('getCommit').and.resolveTo({ data: { - message: '[ci skip] commit with skip prefix' - } - }) + message: '[ci skip] commit with skip prefix', + }, + }), }; - spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); - robot.receive(pullRequestEditedPayload); - done(); + + await dispatcher.dispatch('pull_request_target', 'edited'); }); it('calls checkWIP function', () => { @@ -172,83 +145,79 @@ describe('Oppiabot\'s', () => { }); it('calls get commit', () => { - expect(github.git.getCommit).toHaveBeenCalled(); - expect(github.git.getCommit).toHaveBeenCalledTimes(1); - expect(github.git.getCommit).toHaveBeenCalledWith({ - owner: pullRequestEditedPayload.payload.repository.owner.login, - repo: pullRequestEditedPayload.payload.repository.name, - commit_sha: pullRequestEditedPayload.payload.pull_request.head.sha + expect(octokit.git.getCommit).toHaveBeenCalled(); + expect(octokit.git.getCommit).toHaveBeenCalledTimes(1); + expect(octokit.git.getCommit).toHaveBeenCalledWith({ + owner: pullRequestEditedPayload.repository.owner.login, + repo: pullRequestEditedPayload.repository.name, + commit_sha: pullRequestEditedPayload.pull_request.head.sha, }); }); it('does not assign PR author', () => { - expect(github.issues.addAssignees).not.toHaveBeenCalled(); + expect(octokit.issues.addAssignees).not.toHaveBeenCalled(); }); it('does not create comment for WIP PRs', () => { - expect(github.issues.createComment).not.toHaveBeenCalled(); + expect(octokit.issues.createComment).not.toHaveBeenCalled(); }); }); describe('Checks when PR is opened or reopened', () => { it('should check when PR is opened', async () => { - github.git = { + octokit.git = { getCommit: jasmine.createSpy('getCommit').and.resolveTo({ data: { - message: 'changes' - } - }) + message: 'changes', + }, + }), }; - spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); // Trigger pull_request.opened event. - pullRequestEditedPayload.payload.action = 'opened'; - await robot.receive(pullRequestEditedPayload); + pullRequestEditedPayload.action = 'opened'; + await dispatcher.dispatch('pull_request_target', 'opened'); expect(checkWipDraftPRModule.checkWIP).toHaveBeenCalled(); - expect(github.git.getCommit).toHaveBeenCalled(); - expect(github.issues.addAssignees).toHaveBeenCalled(); - expect(github.issues.addAssignees).toHaveBeenCalledTimes(1); - expect(github.issues.createComment).toHaveBeenCalled(); - expect(github.issues.createComment).toHaveBeenCalledTimes(1); + expect(octokit.git.getCommit).toHaveBeenCalled(); + expect(octokit.issues.addAssignees).toHaveBeenCalled(); + expect(octokit.issues.addAssignees).toHaveBeenCalledTimes(1); + expect(octokit.issues.createComment).toHaveBeenCalled(); + expect(octokit.issues.createComment).toHaveBeenCalledTimes(1); }); - it('should check when PR is reopnend', async () => { - spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); - github.git = { + it('should check when PR is reopened', async () => { + octokit.git = { getCommit: jasmine.createSpy('getCommit').and.resolveTo({ data: { - message: 'commit without skip prefix' - } - }) + message: 'commit without skip prefix', + }, + }), }; // Trigger pull_request.opened event. - pullRequestEditedPayload.payload.action = 'reopened'; - await robot.receive(pullRequestEditedPayload); + pullRequestEditedPayload.action = 'reopened'; + await dispatcher.dispatch('pull_request_target', 'reopened'); expect(checkWipDraftPRModule.checkWIP).toHaveBeenCalled(); - expect(github.git.getCommit).toHaveBeenCalled(); - expect(github.issues.addAssignees).toHaveBeenCalled(); - expect(github.issues.addAssignees).toHaveBeenCalledTimes(1); - expect(github.issues.createComment).toHaveBeenCalled(); - expect(github.issues.createComment).toHaveBeenCalledTimes(1); + expect(octokit.git.getCommit).toHaveBeenCalled(); + expect(octokit.issues.addAssignees).toHaveBeenCalled(); + expect(octokit.issues.addAssignees).toHaveBeenCalledTimes(1); + expect(octokit.issues.createComment).toHaveBeenCalled(); + expect(octokit.issues.createComment).toHaveBeenCalledTimes(1); }); }); describe('Draft PRs', () => { - beforeEach((done) => { - github.git = { + beforeEach(async () => { + octokit.git = { getCommit: jasmine.createSpy('getCommit').and.resolveTo({ data: { - message: 'commit without skip prefix' - } - }) + message: 'commit without skip prefix', + }, + }), }; - spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); // Receive a draft payload and remove WIP from title. - pullRequestEditedPayload.payload.pull_request.draft = true; - pullRequestEditedPayload.payload.pull_request.title = 'Testing Draft'; - robot.receive(pullRequestEditedPayload); - done(); + pullRequestEditedPayload.pull_request.draft = true; + pullRequestEditedPayload.pull_request.title = 'Testing Draft'; + await dispatcher.dispatch('pull_request_target', 'opened'); }); it('calls checkWIP function', () => { @@ -256,12 +225,12 @@ describe('Oppiabot\'s', () => { }); it('calls get commit', () => { - expect(github.git.getCommit).toHaveBeenCalled(); - expect(github.git.getCommit).toHaveBeenCalledTimes(1); - expect(github.git.getCommit).toHaveBeenCalledWith({ - owner: pullRequestEditedPayload.payload.repository.owner.login, - repo: pullRequestEditedPayload.payload.repository.name, - commit_sha: pullRequestEditedPayload.payload.pull_request.head.sha + expect(octokit.git.getCommit).toHaveBeenCalled(); + expect(octokit.git.getCommit).toHaveBeenCalledTimes(1); + expect(octokit.git.getCommit).toHaveBeenCalledWith({ + owner: pullRequestEditedPayload.repository.owner.login, + repo: pullRequestEditedPayload.repository.name, + commit_sha: pullRequestEditedPayload.pull_request.head.sha, }); }); @@ -269,64 +238,58 @@ describe('Oppiabot\'s', () => { expect(checkWipDraftPRModule.checkWIP).toHaveBeenCalledTimes(1); }); - it('calls with draft payload', () => { - const args = checkWipDraftPRModule.checkWIP.calls.argsFor(0)[0]; - expect(args.payload.pull_request.draft).toBe(true); - expect(args.payload.pull_request.title).toBe('Testing Draft'); - }); - - it('assigns PR author', () => { - expect(github.issues.addAssignees).toHaveBeenCalled(); + expect(octokit.issues.addAssignees).toHaveBeenCalled(); const params = { - repo: pullRequestEditedPayload.payload.repository.name, - owner: pullRequestEditedPayload.payload.repository.owner.login, - issue_number: pullRequestEditedPayload.payload.pull_request.number, + repo: pullRequestEditedPayload.repository.name, + owner: pullRequestEditedPayload.repository.owner.login, + issue_number: pullRequestEditedPayload.pull_request.number, assignees: ['testuser7777'], }; - expect(github.issues.addAssignees).toHaveBeenCalledWith(params); + expect(octokit.issues.addAssignees).toHaveBeenCalledWith(params); }); it('creates comment for draft PRs', () => { - expect(github.issues.createComment).toHaveBeenCalled(); - expect(github.issues.createComment).toHaveBeenCalledTimes(1); + expect(octokit.issues.createComment).toHaveBeenCalled(); + expect(octokit.issues.createComment).toHaveBeenCalledTimes(1); - const link = ( - 'here'.link( - 'https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia' + - '#wip--draft-pull-requests') + const link = 'here'.link( + 'https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia' + + '#wip--draft-pull-requests' ); - const author = pullRequestEditedPayload.payload.pull_request.user.login; - const commentBody = ( - 'Hi @' + author + ', when creating WIP/Draft PRs, ensure that ' + + const author = pullRequestEditedPayload.pull_request.user.login; + const commentBody = + 'Hi @' + + author + + ', when creating WIP/Draft PRs, ensure that ' + 'your commit messages are prefixed with **[ci skip]** or ' + '**[skip ci]** to prevent CI checks from running. ' + - 'You can learn more about it ' + link + '.'); - - expect(github.issues.createComment).toHaveBeenCalledWith({ - issue_number: pullRequestEditedPayload.payload.pull_request.number, - owner: pullRequestEditedPayload.payload.repository.owner.login, - repo: pullRequestEditedPayload.payload.repository.name, - body: commentBody + 'You can learn more about it ' + + link + + '.'; + + expect(octokit.issues.createComment).toHaveBeenCalledWith({ + issue_number: pullRequestEditedPayload.pull_request.number, + owner: pullRequestEditedPayload.repository.owner.login, + repo: pullRequestEditedPayload.repository.name, + body: commentBody, }); }); }); describe('Draft PRs with skip prefix', () => { - beforeEach((done) => { - github.git = { + beforeEach(async () => { + octokit.git = { getCommit: jasmine.createSpy('getCommit').and.resolveTo({ data: { - message: '[skip ci] commit with skip prefix' - } - }) + message: '[skip ci] commit with skip prefix', + }, + }), }; - spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); // Receive a draft payload and remove WIP from title. - pullRequestEditedPayload.payload.pull_request.draft = true; - pullRequestEditedPayload.payload.pull_request.title = 'Testing Draft'; - robot.receive(pullRequestEditedPayload); - done(); + pullRequestEditedPayload.pull_request.draft = true; + pullRequestEditedPayload.pull_request.title = 'Testing Draft'; + await dispatcher.dispatch('pull_request_target', 'opened'); }); it('calls checkWIP function', () => { @@ -338,45 +301,37 @@ describe('Oppiabot\'s', () => { }); it('calls get commit', () => { - expect(github.git.getCommit).toHaveBeenCalled(); - expect(github.git.getCommit).toHaveBeenCalledTimes(1); - expect(github.git.getCommit).toHaveBeenCalledWith({ - owner: pullRequestEditedPayload.payload.repository.owner.login, - repo: pullRequestEditedPayload.payload.repository.name, - commit_sha: pullRequestEditedPayload.payload.pull_request.head.sha + expect(octokit.git.getCommit).toHaveBeenCalled(); + expect(octokit.git.getCommit).toHaveBeenCalledTimes(1); + expect(octokit.git.getCommit).toHaveBeenCalledWith({ + owner: pullRequestEditedPayload.repository.owner.login, + repo: pullRequestEditedPayload.repository.name, + commit_sha: pullRequestEditedPayload.pull_request.head.sha, }); }); - it('calls with draft payload', () => { - const args = checkWipDraftPRModule.checkWIP.calls.argsFor(0)[0]; - expect(args.payload.pull_request.draft).toBe(true); - expect(args.payload.pull_request.title).toBe('Testing Draft'); - }); - it('does not assign PR author', () => { - expect(github.issues.addAssignees).not.toHaveBeenCalled(); + expect(octokit.issues.addAssignees).not.toHaveBeenCalled(); }); it('does not create comment for draft PRs', () => { - expect(github.issues.createComment).not.toHaveBeenCalled(); + expect(octokit.issues.createComment).not.toHaveBeenCalled(); }); }); describe('Neither Draft nor WIP PRs', () => { - beforeEach((done) => { - github.git = { + beforeEach(async () => { + octokit.git = { getCommit: jasmine.createSpy('getCommit').and.resolveTo({ data: { - message: '[skip ci] commit with skip prefix' - } - }) + message: '[skip ci] commit with skip prefix', + }, + }), }; - spyOn(checkWipDraftPRModule, 'checkWIP').and.callThrough(); // Receive a neither draft nor WIP payload. - pullRequestEditedPayload.payload.pull_request.draft = false; - pullRequestEditedPayload.payload.pull_request.title = 'Testing'; - robot.receive(pullRequestEditedPayload); - done(); + pullRequestEditedPayload.pull_request.draft = false; + pullRequestEditedPayload.pull_request.title = 'Testing'; + await dispatcher.dispatch('pull_request_target', 'opened'); }); it('calls checkWIP function', () => { @@ -384,15 +339,15 @@ describe('Oppiabot\'s', () => { }); it('does not call get commit', () => { - expect(github.git.getCommit).not.toHaveBeenCalled(); + expect(octokit.git.getCommit).not.toHaveBeenCalled(); }); it('does not assign PR author', () => { - expect(github.issues.addAssignees).not.toHaveBeenCalled(); + expect(octokit.issues.addAssignees).not.toHaveBeenCalled(); }); it('does not create a comment', () => { - expect(github.issues.createComment).not.toHaveBeenCalled(); + expect(octokit.issues.createComment).not.toHaveBeenCalled(); }); }); }); From 2ed2f0ac2fa60b1fba5b06ac78d2a4bb96431c28 Mon Sep 17 00:00:00 2001 From: James James Date: Tue, 29 Jun 2021 15:15:55 +0100 Subject: [PATCH 2/5] address review comments --- actions/src/dispatcher.js | 3 +++ actions_build/index.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/actions/src/dispatcher.js b/actions/src/dispatcher.js index e02738c0..278d6874 100644 --- a/actions/src/dispatcher.js +++ b/actions/src/dispatcher.js @@ -45,12 +45,15 @@ module.exports = { await claCheckGithubActionModule.claCheckGithubAction(); break; case constants.prLabelCheck: + core.info('PR label check triggered'); await PRLabelsModule.checkLabels(); break; case constants.dontMergeLabelCheck: + core.info('Don\'t label check triggered'); await PRLabelsModule.checkUnLabeled(); break; case constants.wipCheck: + core.info('WIP check triggered'); await wipDraftModule.checkWIP(); break; } diff --git a/actions_build/index.js b/actions_build/index.js index b30bd8f1..32d376de 100644 --- a/actions_build/index.js +++ b/actions_build/index.js @@ -240641,12 +240641,15 @@ module.exports = { await claCheckGithubActionModule.claCheckGithubAction(); break; case constants.prLabelCheck: + core.info('PR label check triggered'); await PRLabelsModule.checkLabels(); break; case constants.dontMergeLabelCheck: + core.info('Don\'t label check triggered'); await PRLabelsModule.checkUnLabeled(); break; case constants.wipCheck: + core.info('WIP check triggered'); await wipDraftModule.checkWIP(); break; } From c759d23b50ceb417a9d5720e258ac11ad0047b83 Mon Sep 17 00:00:00 2001 From: James James Date: Mon, 19 Jul 2021 11:49:20 +0100 Subject: [PATCH 3/5] Update actions/src/pull_requests/checkWipDraftPR.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vojtěch Jelínek --- actions/src/pull_requests/checkWipDraftPR.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/actions/src/pull_requests/checkWipDraftPR.js b/actions/src/pull_requests/checkWipDraftPR.js index 20189da2..bfdd4c25 100644 --- a/actions/src/pull_requests/checkWipDraftPR.js +++ b/actions/src/pull_requests/checkWipDraftPR.js @@ -74,9 +74,7 @@ module.exports.checkWIP = async () => { ); const commentBody = - 'Hi @' + - prAuthor + - ', when creating WIP/Draft PRs, ensure that ' + + 'Hi @' + prAuthor + ', when creating WIP/Draft PRs, ensure that ' + 'your commit messages are prefixed with **[ci skip]** or ' + '**[skip ci]** to prevent CI checks from running. ' + 'You can learn more about it ' + From acbca86401c0d6de9cec070b0ff2d88dda916571 Mon Sep 17 00:00:00 2001 From: James James Date: Mon, 19 Jul 2021 11:51:22 +0100 Subject: [PATCH 4/5] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vojtěch Jelínek --- actions/src/pull_requests/checkWipDraftPR.js | 4 +--- actions/src/utils.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/actions/src/pull_requests/checkWipDraftPR.js b/actions/src/pull_requests/checkWipDraftPR.js index bfdd4c25..18bf823f 100644 --- a/actions/src/pull_requests/checkWipDraftPR.js +++ b/actions/src/pull_requests/checkWipDraftPR.js @@ -77,9 +77,7 @@ module.exports.checkWIP = async () => { 'Hi @' + prAuthor + ', when creating WIP/Draft PRs, ensure that ' + 'your commit messages are prefixed with **[ci skip]** or ' + '**[skip ci]** to prevent CI checks from running. ' + - 'You can learn more about it ' + - link + - '.'; + 'You can learn more about it ' + link + '.'; await pingAndAssignUsers(octokit, pullRequest, [prAuthor], commentBody); } diff --git a/actions/src/utils.js b/actions/src/utils.js index 75a6397a..724b9d2d 100644 --- a/actions/src/utils.js +++ b/actions/src/utils.js @@ -1,7 +1,7 @@ const { context } = require('@actions/github'); /** - * This function pings and assigns all pending reviewers to a pull request. + * This function creates a comment and assigns users. * @param {import('@octokit/rest').Octokit} octokit * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest * @param {string[]} assignees From 4ba79c75f4758e69912efd24e4c6f7ba848ae8c5 Mon Sep 17 00:00:00 2001 From: James James Date: Sun, 25 Jul 2021 21:03:57 +0100 Subject: [PATCH 5/5] address review comment --- actions/src/pull_requests/checkWipDraftPR.js | 6 ++++-- actions/src/utils.js | 6 ++++-- actions_build/index.js | 22 ++++++++++---------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/actions/src/pull_requests/checkWipDraftPR.js b/actions/src/pull_requests/checkWipDraftPR.js index 18bf823f..790067df 100644 --- a/actions/src/pull_requests/checkWipDraftPR.js +++ b/actions/src/pull_requests/checkWipDraftPR.js @@ -19,7 +19,7 @@ const core = require('@actions/core'); const { context, GitHub } = require('@actions/github'); -const { pingAndAssignUsers } = require('../utils'); +const { commentAndAssignUsers } = require('../utils'); /** * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest @@ -79,7 +79,9 @@ module.exports.checkWIP = async () => { '**[skip ci]** to prevent CI checks from running. ' + 'You can learn more about it ' + link + '.'; - await pingAndAssignUsers(octokit, pullRequest, [prAuthor], commentBody); + await commentAndAssignUsers( + octokit, pullRequest, [prAuthor], commentBody + ); } } }; diff --git a/actions/src/utils.js b/actions/src/utils.js index 724b9d2d..0f2aec6e 100644 --- a/actions/src/utils.js +++ b/actions/src/utils.js @@ -7,7 +7,9 @@ const { context } = require('@actions/github'); * @param {string[]} assignees * @param {string} comment */ -const pingAndAssignUsers = async (octokit, pullRequest, assignees, comment) => { +const commentAndAssignUsers = async ( + octokit, pullRequest, assignees, comment +) => { await octokit.issues.createComment({ issue_number: pullRequest.number, body: comment, @@ -22,5 +24,5 @@ const pingAndAssignUsers = async (octokit, pullRequest, assignees, comment) => { }; module.exports = { - pingAndAssignUsers, + commentAndAssignUsers, }; diff --git a/actions_build/index.js b/actions_build/index.js index 32d376de..ff8fcda1 100644 --- a/actions_build/index.js +++ b/actions_build/index.js @@ -88813,13 +88813,15 @@ exports.default = promisify; const { context } = __webpack_require__(469); /** - * This function pings and assigns all pending reviewers to a pull request. + * This function creates a comment and assigns users. * @param {import('@octokit/rest').Octokit} octokit * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest * @param {string[]} assignees * @param {string} comment */ -const pingAndAssignUsers = async (octokit, pullRequest, assignees, comment) => { +const commentAndAssignUsers = async ( + octokit, pullRequest, assignees, comment +) => { await octokit.issues.createComment({ issue_number: pullRequest.number, body: comment, @@ -88834,7 +88836,7 @@ const pingAndAssignUsers = async (octokit, pullRequest, assignees, comment) => { }; module.exports = { - pingAndAssignUsers, + commentAndAssignUsers, }; @@ -289243,7 +289245,7 @@ var servicenetworking_v1beta; const core = __webpack_require__(470); const { context, GitHub } = __webpack_require__(469); -const { pingAndAssignUsers } = __webpack_require__(256); +const { commentAndAssignUsers } = __webpack_require__(256); /** * @param {import('@octokit/rest').Octokit.PullsGetResponse} pullRequest @@ -289298,16 +289300,14 @@ module.exports.checkWIP = async () => { ); const commentBody = - 'Hi @' + - prAuthor + - ', when creating WIP/Draft PRs, ensure that ' + + 'Hi @' + prAuthor + ', when creating WIP/Draft PRs, ensure that ' + 'your commit messages are prefixed with **[ci skip]** or ' + '**[skip ci]** to prevent CI checks from running. ' + - 'You can learn more about it ' + - link + - '.'; + 'You can learn more about it ' + link + '.'; - await pingAndAssignUsers(octokit, pullRequest, [prAuthor], commentBody); + await commentAndAssignUsers( + octokit, pullRequest, [prAuthor], commentBody + ); } } };