fix: fix unclosed issues linked to merged pr function
This commit is contained in:
Родитель
fe84c2aa5d
Коммит
d3a2629cae
|
@ -6,6 +6,7 @@ module.exports = function (context, req) {
|
|||
if (req.action !== 'closed' || !req.pull_request.merged) {
|
||||
context.log('Only watch merged PR.');
|
||||
context.done(null, { success: false, message: 'Only watch merged PR.' });
|
||||
return;
|
||||
}
|
||||
var githubApiHeaders = {
|
||||
'User-Agent': 'github-bot-uwp-toolkit',
|
||||
|
@ -21,6 +22,10 @@ module.exports = function (context, req) {
|
|||
.filter(function (r) { return r.__typename === 'Issue' && r.closed === false; })
|
||||
.map(function (r) { return r.__typename === 'Issue' ? r.number : null; })
|
||||
.filter(function (n) { return !!n; });
|
||||
if (unclosedIssuesNumber.length <= 0) {
|
||||
context.done(null, { success: false, message: 'No unclosed issue linked to this merged PR.' });
|
||||
return;
|
||||
}
|
||||
if (process.env.GITHUB_BOT_UWP_TOOLKIT_ACTIVATE_MUTATION) {
|
||||
var linkedItemsMessagePart = unclosedIssuesNumber.map(function (n) { return '#' + n; }).join(', ');
|
||||
github_1.commentGitHubIssue(githubApiHeaders, pullRequest.id, "This PR is linked to unclosed issues. Please check if one of these issues should be closed: " + linkedItemsMessagePart);
|
||||
|
|
|
@ -6,6 +6,7 @@ module.exports = (context, req) => {
|
|||
if (req.action !== 'closed' || !req.pull_request.merged) {
|
||||
context.log('Only watch merged PR.');
|
||||
context.done(null, { success: false, message: 'Only watch merged PR.' });
|
||||
return;
|
||||
}
|
||||
|
||||
const githubApiHeaders = {
|
||||
|
@ -34,6 +35,11 @@ module.exports = (context, req) => {
|
|||
.map(r => r.__typename === 'Issue' ? r.number : null)
|
||||
.filter(n => !!n);
|
||||
|
||||
if (unclosedIssuesNumber.length <= 0) {
|
||||
context.done(null, { success: false, message: 'No unclosed issue linked to this merged PR.' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.env.GITHUB_BOT_UWP_TOOLKIT_ACTIVATE_MUTATION) {
|
||||
// send a message with links to unclosed issues
|
||||
const linkedItemsMessagePart = unclosedIssuesNumber.map(n => '#' + n).join(', ');
|
||||
|
|
Загрузка…
Ссылка в новой задаче