You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2021/11/29 06:45:03 UTC

[echarts-bot] branch master updated: update bot for new issue template apache/echarts#16128

This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 22ddfd1  update bot for new issue template apache/echarts#16128
22ddfd1 is described below

commit 22ddfd14864079db172c2ea73ae64da437703497
Author: Ovilia <zw...@gmail.com>
AuthorDate: Mon Nov 29 14:44:38 2021 +0800

    update bot for new issue template apache/echarts#16128
---
 src/issue.js | 48 +++++++++++-------------------------------------
 1 file changed, 11 insertions(+), 37 deletions(-)

diff --git a/src/issue.js b/src/issue.js
index 839fbf2..bf641ac 100644
--- a/src/issue.js
+++ b/src/issue.js
@@ -23,38 +23,20 @@ class Issue {
     async init () {
         // if author is committer, do not check if using template
         const isCore = isCommitter(this.issue.author_association, this.issue.user.login);
-        if (isCore || this.isUsingTemplate()) {
-            if (this._contain('Steps to reproduce')) {
-                this.issueType = label.BUG;
-            } else if (this._contain('What problem does this feature solve')) {
-                this.issueType = label.NEW_FEATURE;
-            } else if (!isCore) {
-                this.response = text.NOT_USING_TEMPLATE;
-                return;
-            }
 
-            if (!isCore) {
-                this.addLabels.push(label.PENDING);
-                this.addLabels.push(label.WAITING_FOR_COMMUNITY);
-            }
-
-            this.issueType && this.addLabels.push(this.issueType);
-
-            // translate issue
-            isCore || await this._translate();
+        if (!isCore) {
+            this.addLabels.push(label.PENDING);
+            this.addLabels.push(label.WAITING_FOR_COMMUNITY);
+        }
 
-            // const isInEnglish = this._contain('This issue is in English');
-            const isInEnglish = (!this.translatedTitle && !this.translatedBody)
-              || (!this.title.trim() && !this.translatedBody)
-              || (!this.body.trim() && !this.translatedTitle);
-            if (isInEnglish) {
-                this.addLabels.push(label.EN);
-            }
+        // translate issue
+        await this._translate();
 
-            isCore || this._computeResponse();
-        } else {
-            this.response = text.NOT_USING_TEMPLATE;
-            this.addLabels.push(label.INVALID);
+        const isInEnglish = (!this.translatedTitle && !this.translatedBody)
+            || (!this.title.trim() && !this.translatedBody)
+            || (!this.body.trim() && !this.translatedTitle);
+        if (isInEnglish) {
+            this.addLabels.push(label.EN);
         }
     }
 
@@ -69,10 +51,6 @@ class Issue {
         }
     }
 
-    isUsingTemplate() {
-        return this.body.indexOf('generated by echarts-issue-helper') > -1;
-    }
-
     _computeResponse() {
         switch(this.context.payload.action) {
             case 'opened':
@@ -85,10 +63,6 @@ class Issue {
                 break;
         }
     }
-
-    _contain(txt) {
-        return this.body.indexOf(txt) > -1;
-    }
 }
 
 module.exports = Issue;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org