feat: alert PR assignees when there is no activity fix #17
This commit is contained in:
Родитель
5e264acfd4
Коммит
d167c122e1
|
@ -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;
|
||||
|
|
|
@ -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?`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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, {
|
||||
|
|
|
@ -259,6 +259,14 @@ const getAllOpenPullRequestsQuery = (repoOwner: string, repoName: string) => {
|
|||
},
|
||||
milestone {
|
||||
number
|
||||
},
|
||||
assignees(first: 10) {
|
||||
edges {
|
||||
node {
|
||||
id,
|
||||
login
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || Object.assign || function(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))
|
||||
|
@ -7,6 +8,8 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
|||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var querystring = require("querystring");
|
||||
var https = require("https");
|
||||
|
|
|
@ -122,6 +122,14 @@ export type PullRequest = {
|
|||
}[];
|
||||
};
|
||||
milestone: MilestoneWithNumberAndState | undefined;
|
||||
assignees: {
|
||||
edges: {
|
||||
node: {
|
||||
id: string,
|
||||
login: string
|
||||
}
|
||||
}[];
|
||||
};
|
||||
}
|
||||
|
||||
export type IssueWithLabels = {
|
||||
|
|
|
@ -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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче