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

add info log and update bot-token name

上级 0348b562
...@@ -20,4 +20,4 @@ jobs: ...@@ -20,4 +20,4 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: ./ - uses: ./
with: with:
bot_github_token: ${{ secrets.BOT_GITHUB_TOKEN }} BOT_GITHUB_TOKEN: "${{ secrets.BOT_GITHUB_TOKEN }}"
...@@ -2,9 +2,9 @@ name: 'issue translator' ...@@ -2,9 +2,9 @@ name: 'issue translator'
description: 'The action for translating non-english issues content to english.' description: 'The action for translating non-english issues content to english.'
author: 'tomsun28' author: 'tomsun28'
inputs: inputs:
bot_github_token: BOT_GITHUB_TOKEN:
required: true required: true
description: 'bot_github_token' description: 'The issue comment bot's GITHUB_TOKEN'
runs: runs:
using: 'node12' using: 'node12'
main: 'dist/index.js' main: 'dist/index.js'
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
...@@ -42,6 +42,9 @@ async function run(): Promise<void> { ...@@ -42,6 +42,9 @@ async function run(): Promise<void> {
function detectIsEnglish(body: string): boolean | true { function detectIsEnglish(body: string): boolean | true {
const lngDetector = new LanguageDetect() const lngDetector = new LanguageDetect()
const detectResult = lngDetector.detect(body, 1) const detectResult = lngDetector.detect(body, 1)
for (let i = 0; i < detectResult.length; i++) {
core.info(detectResult[i][0] + detectResult[i][1])
}
return detectResult.length === 1 && detectResult[0][0] === 'english' return detectResult.length === 1 && detectResult[0][0] === 'english'
} }
...@@ -61,7 +64,9 @@ async function translateCommentBody(body: string): Promise<string> { ...@@ -61,7 +64,9 @@ async function translateCommentBody(body: string): Promise<string> {
async function createComment(issueId: number, body: string): Promise<void> { async function createComment(issueId: number, body: string): Promise<void> {
const {owner, repo} = github.context.repo const {owner, repo} = github.context.repo
const myToken = core.getInput('bot_github_token') core.info(owner + repo)
const myToken = core.getInput('BOT_GITHUB_TOKEN')
core.info(myToken)
const octokit = github.getOctokit(myToken) const octokit = github.getOctokit(myToken)
await octokit.issues.createComment({ await octokit.issues.createComment({
owner, owner,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册