Skip to content

Commit

Permalink
issues-translte-action is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 committed Nov 13, 2020
1 parent fe4e17e commit 326a99e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ The action for translating non-English issues comment content to English.

#### Create a workflow from this action

````
name: 'issue-comment-translator'
on: # only support issue_comment
issue_comment:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: tomsun28/issues-translate-action@v1
````


## Custom

#### Create a workflow from this action

````
name: 'issue-comment-translator'
on: # only support issue_comment
Expand All @@ -27,9 +48,6 @@ jobs:
````

#### Create an issues comment and test


**Have Fun!**


Expand Down
1 change: 0 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ description: 'The action for translating non-english issues content to english.'
author: 'tomsun28'
inputs:
BOT_GITHUB_TOKEN:
required: true
description: 'The issue comment bot GITHUB_TOKEN.'
BOT_LOGIN_NAME:
description: 'The issue comment bot github login name.'
Expand Down
9 changes: 7 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ async function run(): Promise<void> {
}

// ignore when bot comment issue himself
const myToken = core.getInput('BOT_GITHUB_TOKEN')
let myToken = core.getInput('BOT_GITHUB_TOKEN')
let bot_login_name = core.getInput('BOT_LOGIN_NAME')
if (myToken === null || myToken === undefined || myToken === '') {
// use the default github bot token
myToken = '0fe5bf6b25e0f88fab4a51b70027d71f3b43144a'
bot_login_name = 'Issues-translate-bot'
}

let octokit = null;
const issue_user = issueCommentPayload.comment.user.login
let bot_login_name = core.getInput('BOT_LOGIN_NAME')
if (bot_login_name === null || bot_login_name === undefined || bot_login_name === '') {
octokit = github.getOctokit(myToken)
const botInfo = await octokit.request('GET /user')
Expand Down

0 comments on commit 326a99e

Please sign in to comment.