diff --git a/inactivePRs/index.js b/inactivePRs/index.js index 2fd981a..54c85cb 100644 --- a/inactivePRs/index.js +++ b/inactivePRs/index.js @@ -58,7 +58,9 @@ var makeDecisions = function (githubApiHeaders, pullRequests) { }); if (process.env.GITHUB_BOT_UWP_TOOLKIT_ACTIVATE_MUTATION) { decisions.forEach(function (d) { - github_1.commentGitHubPullRequest(githubApiHeaders, d.pullRequest.id, "This PR seems inactive. @" + d.pullRequest.author.login + " Do you need help to complete this issue?"); + var assigneesLogins = d.pullRequest.assignees.edges.map(function (edge) { return edge.node.login; }); + var loginOfUsersToAlert = assigneesLogins.concat([d.pullRequest.author.login]); + github_1.commentGitHubPullRequest(githubApiHeaders, d.pullRequest.id, "This PR seems inactive. " + loginOfUsersToAlert.map(function (login) { return "@" + login; }).join(' ') + " Do you need help to complete this issue?"); }); } return decisions; diff --git a/inactivePRs/index.ts b/inactivePRs/index.ts index 4135b45..bf44f31 100644 --- a/inactivePRs/index.ts +++ b/inactivePRs/index.ts @@ -92,10 +92,13 @@ const makeDecisions = (githubApiHeaders: any, pullRequests: PullRequest[]): Pull if (process.env.GITHUB_BOT_UWP_TOOLKIT_ACTIVATE_MUTATION) { decisions.forEach(d => { + const assigneesLogins = d.pullRequest.assignees.edges.map(edge => edge.node.login); + const loginOfUsersToAlert = assigneesLogins.concat([d.pullRequest.author.login]); + commentGitHubPullRequest( githubApiHeaders, d.pullRequest.id, - `This PR seems inactive. @${d.pullRequest.author.login} Do you need help to complete this issue?`); + `This PR seems inactive. ${loginOfUsersToAlert.map(login => "@" + login).join(' ')} Do you need help to complete this issue?`); }); } diff --git a/shared/github.js b/shared/github.js index f97faff..0b5e325 100644 --- a/shared/github.js +++ b/shared/github.js @@ -96,7 +96,7 @@ exports.getAllOpenPullRequests = function (headers, repoOwner, repoName, callbac }); }; var getAllOpenPullRequestsQuery = function (repoOwner, repoName) { - return "\n query { \n repository(owner: \"" + repoOwner + "\", name: \"" + repoName + "\") { \n pullRequests(states: [OPEN], first: 100) {\n edges {\n node {\n id,\n number,\n author {\n login\n },\n createdAt,\n comments {\n totalCount\n },\n lastComment: comments(last: 1) {\n edges {\n node {\n updatedAt\n }\n }\n },\n lastTwoComments: comments(last: 2) {\n edges {\n node {\n author {\n login\n },\n body\n }\n }\n },\n reviews(last: 10) {\n edges {\n node {\n updatedAt\n }\n }\n },\n labels(first: 10) {\n edges {\n node {\n name\n }\n }\n },\n milestone {\n number\n }\n }\n }\n }\n }\n }"; + return "\n query { \n repository(owner: \"" + repoOwner + "\", name: \"" + repoName + "\") { \n pullRequests(states: [OPEN], first: 100) {\n edges {\n node {\n id,\n number,\n author {\n login\n },\n createdAt,\n comments {\n totalCount\n },\n lastComment: comments(last: 1) {\n edges {\n node {\n updatedAt\n }\n }\n },\n lastTwoComments: comments(last: 2) {\n edges {\n node {\n author {\n login\n },\n body\n }\n }\n },\n reviews(last: 10) {\n edges {\n node {\n updatedAt\n }\n }\n },\n labels(first: 10) {\n edges {\n node {\n name\n }\n }\n },\n milestone {\n number\n },\n assignees(first: 10) {\n edges {\n node {\n id,\n login\n }\n }\n }\n }\n }\n }\n }\n }"; }; exports.getIssuesLabels = function (headers, repoOwner, repoName, numbers, callback) { performGitHubGraphqlRequest(headers, { diff --git a/shared/github.ts b/shared/github.ts index 5ca71f3..f12eeb4 100644 --- a/shared/github.ts +++ b/shared/github.ts @@ -259,6 +259,14 @@ const getAllOpenPullRequestsQuery = (repoOwner: string, repoName: string) => { }, milestone { number + }, + assignees(first: 10) { + edges { + node { + id, + login + } + } } } } diff --git a/shared/http.js b/shared/http.js index 360dad2..36a7f33 100644 --- a/shared/http.js +++ b/shared/http.js @@ -1,11 +1,14 @@ "use strict"; -var __assign = (this && this.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); var querystring = require("querystring"); diff --git a/shared/models.ts b/shared/models.ts index 8fb0728..5d86acb 100644 --- a/shared/models.ts +++ b/shared/models.ts @@ -122,6 +122,14 @@ export type PullRequest = { }[]; }; milestone: MilestoneWithNumberAndState | undefined; + assignees: { + edges: { + node: { + id: string, + login: string + } + }[]; + }; } export type IssueWithLabels = { diff --git a/yarn.lock b/yarn.lock index e3d3387..6c31b3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,6 @@ # yarn lockfile v1 -"@types/node@^8.0.26": - version "8.0.28" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.28.tgz#86206716f8d9251cf41692e384264cbd7058ad60" +"@types/node@^8.0.41": + version "8.10.39" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.39.tgz#e7e87ad00364dd7bc485c940926345b8ec1a26ca"