Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ TDesign 共享的 GitHub Actions 工作流。

| Action | 说明 |
|--------|------|
| `ai-translate` | 调用 OpenAI 兼容 API 翻译文本,输出 `translated-text`,支持自定义 prompt 模板、标题头,提供 `issue-number` 时自动发评论并输出 `comment-id` |
| `check-email` | 检查 commit 邮箱是否符合规范(不能是 @tencent.com) |
| `close-release-issue` | 合并 release 分支时关闭带有特定标签的 issues |
| `cnb-delete-branch` | 删除 CNB 分支前先关闭关联的 PR |
Expand Down
54 changes: 54 additions & 0 deletions actions/ai-translate/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: AI Translate
description: Translate text with an OpenAI-compatible LLM API and optionally post it as a comment

branding:
icon: globe
color: blue

inputs:
api-key:
description: API key for the LLM provider
required: true
base-url:
description: OpenAI-compatible API base URL
required: false
default: https://tokenhub.tencentmaas.com/v1
model:
description: Model name used for translation
required: false
default: hy-mt2-plus
target-lang:
description: Target language, e.g. 英语
required: true
source-text:
description: Text to translate
required: true
prompt:
description: Custom prompt template. Supports {targetLang} and {sourceText} placeholders; source text is appended when no placeholder is used
required: false
title:
description: Title heading prepended to the translated text, e.g. 会议确认. Output as-is without translation
required: false
issue-number:
description: Issue or pull request number to post the result as a comment. Skip commenting when not provided
required: false
token:
description: GitHub token used for commenting
required: false
default: ${{ github.token }}
owner:
description: Repository owner for commenting. Defaults to the current repository owner
required: false
repo:
description: Repository name for commenting. Defaults to the current repository name
required: false

outputs:
translated-text:
description: Translated text, prefixed with the title heading when title is provided
comment-id:
description: Created comment ID. Empty when issue-number is not provided

runs:
using: node24
main: dist/index.mjs
Loading
Loading