Skip to content
Permalink
Browse files
feat: pr label
  • Loading branch information
Ovilia committed Feb 17, 2020
1 parent ab6abe3 commit 27926dba30a77a7a07bb7123f62bcb1992199514
Showing 2 changed files with 24 additions and 7 deletions.
@@ -1,5 +1,4 @@
const Issue = require('./src/issue');
const coreCommitters = require('./src/coreCommitters');
const text = require('./src/text');

module.exports = app => {
@@ -33,7 +32,6 @@ module.exports = app => {
);
};

// console.log(context.payload);
switch (context.payload.label.name) {
case 'invalid':
return Promise.all([commentIssue(context, text.NOT_USING_TEMPLATE), closeIssue(context)]);
@@ -44,6 +42,15 @@ module.exports = app => {
case 'inactive':
return Promise.all([commentIssue(context, text.INACTIVE_ISSUE), closeIssue(context)]);

case 'missing-demo':
return Promise.all([
commentIssue(context, replaceAt(text.MISSING_DEMO)),
getRemoveLabel(context, 'waiting-for: community'),
context.github.issues.addLabels(context.issue({
labels: ['waiting-for: author']
}))
]);

// case 'waiting-for: author':
// return commentIssue(context, replaceAt(text.ISSUE_TAGGED_WAITING_AUTHOR));

@@ -66,9 +73,9 @@ module.exports = app => {
const isCommenterAuthor = commenter === context.payload.issue.user.login;
let removeLabel;
let addLabel;
if (coreCommitters.isCoreCommitter(commenter) && !isCommenterAuthor) {
if (isCommitter(context.payload.comment.author_association)) {
// New comment from core committers
removeLabel = getRemoveLabel(context, 'waiting-for: help');
removeLabel = getRemoveLabel(context, 'waiting-for: community');
}
else if (isCommenterAuthor) {
// New comment from issue author
@@ -80,8 +87,7 @@ module.exports = app => {
return Promise.all([removeLabel, addLabel]);
});

// Pull Requests Not Tested Yet
app.on(['pull_request.opened', 'pull_request.reopened'], async context => {
app.on(['pull_request.opened'], async context => {
const auth = context.payload.pull_request.author_association;
const comment = context.github.issues.createComment(context.issue({
body: isCommitter(auth) ? text.PR_OPENED_BY_COMMITTER : text.PR_OPENED
@@ -95,8 +101,15 @@ module.exports = app => {
labels: labelList
}));

return Promise.all([comment, addLabel]);
});

app.on(['pull_request.synchronize'], async context => {
const addLabel = context.github.issues.addLabels(context.issue({
labels: ['PR: awaiting review']
}));
const removeLabel = getRemoveLabel(context, 'PR: revision needed');
return Promise.all([comment, addLabel, removeLabel]);
return Promise.all([addLabel, removeLabel]);
});

app.on(['pull_request.closed'], async context => {
@@ -39,6 +39,9 @@ AT_ISSUE_AUTHOR Would you like to debug it by yourself? This is a quicker way to
Please have a look at [How to debug ECharts](https://github.com/apache/incubator-echarts/blob/master/CONTRIBUTING.md#how-to-debug-echarts) if you'd like to give a try. 🤓`;

const MISSING_DEMO =
`AT_ISSUE_AUTHOR Please provide a demo for the issue either with https://jsfiddle.net/ovilia/n6xc4df3/ or https://gallery.echartsjs.com/editor.html.`;

const ISSUE_TAGGED_PRIORITY_HIGH =
`This issue is labeled with \`priority: high\`, which means it's a frequently asked problem and we will fix it ASAP.`;

@@ -76,6 +79,7 @@ module.exports = {
NOT_USING_TEMPLATE,
ISSUE_CREATED,
ISSUE_UPDATED,
MISSING_DEMO,
INACTIVE_ISSUE,
PR_OPENED,
LABEL_HOWTO,

0 comments on commit 27926db

Please sign in to comment.