fix bug when only title is not english
This commit is contained in:
+18
-2
@@ -4636,7 +4636,6 @@ function run() {
|
|||||||
if (originComment === null || originComment === 'null') {
|
if (originComment === null || originComment === 'null') {
|
||||||
needCommitComment = false;
|
needCommitComment = false;
|
||||||
}
|
}
|
||||||
translateOrigin = originComment;
|
|
||||||
needCommitTitle = false;
|
needCommitTitle = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -4652,7 +4651,6 @@ function run() {
|
|||||||
if (originTitle === null || originTitle === 'null') {
|
if (originTitle === null || originTitle === 'null') {
|
||||||
needCommitTitle = false;
|
needCommitTitle = false;
|
||||||
}
|
}
|
||||||
translateOrigin = originComment + '@@====' + originTitle;
|
|
||||||
}
|
}
|
||||||
// detect issue title comment body is english
|
// detect issue title comment body is english
|
||||||
if (originComment !== null && detectIsEnglish(originComment)) {
|
if (originComment !== null && detectIsEnglish(originComment)) {
|
||||||
@@ -4667,6 +4665,15 @@ function run() {
|
|||||||
core.info('Detect the issue do not need translated, return.');
|
core.info('Detect the issue do not need translated, return.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (needCommitComment && needCommitTitle) {
|
||||||
|
translateOrigin = originComment + '@@====' + originTitle;
|
||||||
|
}
|
||||||
|
else if (needCommitComment) {
|
||||||
|
translateOrigin = originComment;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
translateOrigin = 'null@@====' + originTitle;
|
||||||
|
}
|
||||||
// ignore when bot comment issue himself
|
// ignore when bot comment issue himself
|
||||||
let botToken = core.getInput('BOT_GITHUB_TOKEN');
|
let botToken = core.getInput('BOT_GITHUB_TOKEN');
|
||||||
let botLoginName = core.getInput('BOT_LOGIN_NAME');
|
let botLoginName = core.getInput('BOT_LOGIN_NAME');
|
||||||
@@ -4709,10 +4716,19 @@ function run() {
|
|||||||
core.info(`translate body is: ${translateTmp}`);
|
core.info(`translate body is: ${translateTmp}`);
|
||||||
if (translateBody.length == 1) {
|
if (translateBody.length == 1) {
|
||||||
translateComment = translateBody[0].trim();
|
translateComment = translateBody[0].trim();
|
||||||
|
if (translateComment === originComment) {
|
||||||
|
needCommitComment = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (translateBody.length == 2) {
|
else if (translateBody.length == 2) {
|
||||||
translateComment = translateBody[0].trim();
|
translateComment = translateBody[0].trim();
|
||||||
translateTitle = translateBody[1].trim();
|
translateTitle = translateBody[1].trim();
|
||||||
|
if (translateComment === originComment) {
|
||||||
|
needCommitComment = false;
|
||||||
|
}
|
||||||
|
if (translateTitle === originTitle) {
|
||||||
|
needCommitTitle = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.setFailed(`the translateBody is ${translateTmp}`);
|
core.setFailed(`the translateBody is ${translateTmp}`);
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+16
-2
@@ -37,7 +37,6 @@ async function run(): Promise<void> {
|
|||||||
if (originComment === null || originComment === 'null') {
|
if (originComment === null || originComment === 'null') {
|
||||||
needCommitComment = false
|
needCommitComment = false
|
||||||
}
|
}
|
||||||
translateOrigin = originComment
|
|
||||||
needCommitTitle = false
|
needCommitTitle = false
|
||||||
} else {
|
} else {
|
||||||
const issuePayload = github.context
|
const issuePayload = github.context
|
||||||
@@ -52,7 +51,6 @@ async function run(): Promise<void> {
|
|||||||
if (originTitle === null || originTitle === 'null') {
|
if (originTitle === null || originTitle === 'null') {
|
||||||
needCommitTitle = false
|
needCommitTitle = false
|
||||||
}
|
}
|
||||||
translateOrigin = originComment + '@@====' + originTitle
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect issue title comment body is english
|
// detect issue title comment body is english
|
||||||
@@ -68,6 +66,13 @@ async function run(): Promise<void> {
|
|||||||
core.info('Detect the issue do not need translated, return.')
|
core.info('Detect the issue do not need translated, return.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (needCommitComment && needCommitTitle) {
|
||||||
|
translateOrigin = originComment + '@@====' + originTitle
|
||||||
|
} else if (needCommitComment) {
|
||||||
|
translateOrigin = originComment
|
||||||
|
} else {
|
||||||
|
translateOrigin = 'null@@====' + originTitle
|
||||||
|
}
|
||||||
|
|
||||||
// ignore when bot comment issue himself
|
// ignore when bot comment issue himself
|
||||||
let botToken = core.getInput('BOT_GITHUB_TOKEN')
|
let botToken = core.getInput('BOT_GITHUB_TOKEN')
|
||||||
@@ -126,9 +131,18 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
if (translateBody.length == 1) {
|
if (translateBody.length == 1) {
|
||||||
translateComment = translateBody[0].trim()
|
translateComment = translateBody[0].trim()
|
||||||
|
if (translateComment === originComment) {
|
||||||
|
needCommitComment = false
|
||||||
|
}
|
||||||
} else if (translateBody.length == 2) {
|
} else if (translateBody.length == 2) {
|
||||||
translateComment = translateBody[0].trim()
|
translateComment = translateBody[0].trim()
|
||||||
translateTitle = translateBody[1].trim()
|
translateTitle = translateBody[1].trim()
|
||||||
|
if (translateComment === originComment) {
|
||||||
|
needCommitComment = false
|
||||||
|
}
|
||||||
|
if (translateTitle === originTitle) {
|
||||||
|
needCommitTitle = false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
core.setFailed(`the translateBody is ${translateTmp}`)
|
core.setFailed(`the translateBody is ${translateTmp}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user