diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a16790d5753a83d03fe11d0c29b27d0d5e9a128d..d1033f0fda5349c7ef1a966da0d58b6728d5ffdb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,4 +20,4 @@ jobs: - uses: actions/checkout@v2 - uses: ./ with: - bot_github_token: ${{ secrets.BOT_GITHUB_TOKEN }} + BOT_GITHUB_TOKEN: "${{ secrets.BOT_GITHUB_TOKEN }}" diff --git a/action.yml b/action.yml index a96fdf0e5b69fb0c5444bd4457cc10af6771da7b..f7b8be06378da3e76ceb9cc0be9649d907f60e25 100644 --- a/action.yml +++ b/action.yml @@ -2,9 +2,9 @@ name: 'issue translator' description: 'The action for translating non-english issues content to english.' author: 'tomsun28' inputs: - bot_github_token: + BOT_GITHUB_TOKEN: required: true - description: 'bot_github_token' + description: 'The issue comment bot's GITHUB_TOKEN' runs: using: 'node12' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index ff1e691797d1fb4fe7913a5c9ed748b9f2be9b19..b0be6b1582cf1fd88b33b2d6ee084bd57106d7d1 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 59d0f68cc8ff9d577d05e91d65646f1e924c45b7..41a55dd4f0becc6b30b0cc60be8caad3089e87d8 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/main.ts b/src/main.ts index f40c8fa5a6bfc532b4ed01108688d38ad9fe2427..50098bcdd96eb3f62b43811485a237ec6b4f25ec 100644 --- a/src/main.ts +++ b/src/main.ts @@ -42,6 +42,9 @@ async function run(): Promise { function detectIsEnglish(body: string): boolean | true { const lngDetector = new LanguageDetect() 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' } @@ -61,7 +64,9 @@ async function translateCommentBody(body: string): Promise { async function createComment(issueId: number, body: string): Promise { 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) await octokit.issues.createComment({ owner,