feat: pr label
diff --git a/index.js b/index.js
index fe0422a..2c51d00 100644
--- a/index.js
+++ b/index.js
@@ -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 @@
);
};
- // 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 @@
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 @@
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 @@
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 @@
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 => {
diff --git a/src/text.js b/src/text.js
index ab01a9a..3d20b05 100644
--- a/src/text.js
+++ b/src/text.js
@@ -39,6 +39,9 @@
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 @@
NOT_USING_TEMPLATE,
ISSUE_CREATED,
ISSUE_UPDATED,
+ MISSING_DEMO,
INACTIVE_ISSUE,
PR_OPENED,
LABEL_HOWTO,