fix: fix issue translate bug.
diff --git a/index.js b/index.js
index fb01555..c58474d 100644
--- a/index.js
+++ b/index.js
@@ -15,6 +15,8 @@
? Promise.resolve()
: commentIssue(context, issue.response);
+ await comment;
+
const addLabels = issue.addLabels.length
? context.octokit.issues.addLabels(
context.issue({
@@ -27,11 +29,15 @@
? getRemoveLabel(issue.removeLabel)
: Promise.resolve();
- const translate = issue.response === text.ISSUE_CREATED
- ? Promise.resolve()
- : translateIssue(context, issue);
+ // then add and remove label
+ await Promise.all([addLabels, removeLabel]);
- return Promise.all([comment, addLabels, removeLabel, translate]);
+ // translate finally
+ const translate = issue.response === text.ISSUE_CREATED
+ ? translateIssue(context, issue)
+ : Promise.resolve();
+
+ return translate;
});
app.on('issues.labeled', async context => {
diff --git a/src/issue.js b/src/issue.js
index c359ae2..7d900a4 100644
--- a/src/issue.js
+++ b/src/issue.js
@@ -40,7 +40,7 @@
this.issueType && this.addLabels.push(this.issueType);
// translate issue
- await this._translate();
+ isCore || await this._translate();
// const isInEnglish = this._contain('This issue is in English');
const isInEnglish = (!this.translatedTitle && !this.translatedBody)