提交 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> {
try {
if (
(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(
`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
let result = ''
await translate(body, {to: 'en'})
.then(res => {
result =
if (res.text !== body) {
result =
`
> @${issueUser}
> 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
${res.text}
`
}
})
.catch(err => {
core.error(err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册