提交 b5ce9851 编写于 作者: sinat_25235033's avatar sinat_25235033

fix bug when translate body equal origin

上级 bef15eee
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
...@@ -9,7 +9,7 @@ async function run(): Promise<void> { ...@@ -9,7 +9,7 @@ async function run(): Promise<void> {
try { try {
if ( if (
(github.context.eventName !== 'issue_comment' || github.context.payload.action !== 'created') && (github.context.eventName !== 'issue_comment' || github.context.payload.action !== 'created') &&
(github.context.eventName != 'issues' || github.context.payload.action !== 'opened') (github.context.eventName !== 'issues' || github.context.payload.action !== 'opened')
) { ) {
core.info( core.info(
`The status of the action must be created on issue_comment, no applicable - ${github.context.payload.action} on ${github.context.eventName}, return` `The status of the action must be created on issue_comment, no applicable - ${github.context.payload.action} on ${github.context.eventName}, return`
...@@ -105,7 +105,8 @@ async function translateCommentBody(body: string, issueUser: string): Promise<st ...@@ -105,7 +105,8 @@ async function translateCommentBody(body: string, issueUser: string): Promise<st
let result = '' let result = ''
await translate(body, {to: 'en'}) await translate(body, {to: 'en'})
.then(res => { .then(res => {
result = if (res.text !== body) {
result =
` `
> @${issueUser} > @${issueUser}
> Bot detected the issue body's language is not English, translate it automatically. For the convenience of others, please use English next time👯. > Bot detected the issue body's language is not English, translate it automatically. For the convenience of others, please use English next time👯.
...@@ -113,6 +114,7 @@ async function translateCommentBody(body: string, issueUser: string): Promise<st ...@@ -113,6 +114,7 @@ async function translateCommentBody(body: string, issueUser: string): Promise<st
${res.text} ${res.text}
` `
}
}) })
.catch(err => { .catch(err => {
core.error(err) core.error(err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册