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

issues-translte-action is ready

上级 fe4e17e7
...@@ -8,6 +8,27 @@ The action for translating non-English issues comment content to English. ...@@ -8,6 +8,27 @@ The action for translating non-English issues comment content to English.
#### Create a workflow from this action #### 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' name: 'issue-comment-translator'
on: # only support issue_comment on: # only support issue_comment
...@@ -27,9 +48,6 @@ jobs: ...@@ -27,9 +48,6 @@ jobs:
```` ````
#### Create an issues comment and test
**Have Fun!** **Have Fun!**
......
...@@ -3,7 +3,6 @@ description: 'The action for translating non-english issues content to english.' ...@@ -3,7 +3,6 @@ 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
description: 'The issue comment bot GITHUB_TOKEN.' description: 'The issue comment bot GITHUB_TOKEN.'
BOT_LOGIN_NAME: BOT_LOGIN_NAME:
description: 'The issue comment bot github login name.' description: 'The issue comment bot github login name.'
......
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
...@@ -27,10 +27,16 @@ async function run(): Promise<void> { ...@@ -27,10 +27,16 @@ async function run(): Promise<void> {
} }
// ignore when bot comment issue himself // 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; let octokit = null;
const issue_user = issueCommentPayload.comment.user.login 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 === '') { if (bot_login_name === null || bot_login_name === undefined || bot_login_name === '') {
octokit = github.getOctokit(myToken) octokit = github.getOctokit(myToken)
const botInfo = await octokit.request('GET /user') const botInfo = await octokit.request('GET /user')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册