1+ # Copyright 2024-2026 the original author or authors.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # https://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ name : Issue Translation
16+ on :
17+ issues :
18+ types : [opened, edited]
19+ env :
20+ ANTHROPIC_BASE_URL : " https://open.bigmodel.cn/api/anthropic"
21+ jobs :
22+ translate-issue :
23+ runs-on : ubuntu-latest
24+ permissions :
25+ contents : read
26+ issues : write
27+ id-token : write
28+ steps :
29+ - name : Create translation prompt
30+ run : |
31+ mkdir -p /tmp/claude-prompts
32+ cat > /tmp/claude-prompts/translation-prompt.txt << 'EOF'
33+ 你是一个专业的翻译助手。请翻译以下 GitHub issue 的内容。
34+
35+ 任务:
36+ 1. 使用 mcp__github__get_issue 获取 issue 详情
37+ 2. 检测 issue 标题和内容的语言
38+ 3. 如果是中文,翻译成英文;如果是英文,翻译成中文
39+ 4. 使用 mcp__github__update_issue 更新 issue,在原内容下方添加翻译
40+
41+ Issue 信息:
42+ - REPO: ${{ github.repository }}
43+ - ISSUE_NUMBER: ${{ github.event.issue.number }}
44+
45+ 翻译格式:
46+ ---
47+ **Translation / 翻译**
48+ [翻译内容]
49+ EOF
50+
51+ - name : Run Claude Code for Translation
52+ uses : anthropics/claude-code-action@v1
53+ with :
54+ prompt : |
55+ 你是一个专业的翻译助手。请翻译以下 GitHub issue 的内容。
56+
57+ 任务:
58+ 1. 使用 mcp__github__get_issue 获取 issue 详情
59+ 2. 检测 issue 标题和内容的语言
60+ 3. 如果是中文,翻译成英文;如果是英文,翻译成中文
61+ 4. 使用 mcp__github__update_issue 更新 issue,在原内容下方添加翻译
62+
63+ Issue 信息:
64+ - REPO : ${{ github.repository }}
65+ - ISSUE_NUMBER : ${{ github.event.issue.number }}
66+
67+ 翻译格式:
68+ ---
69+ **Translation / 翻译**
70+ [翻译内容]
71+ anthropic_api_key : ${{ secrets.ANTHROPIC_API_KEY }}
72+ claude_args : |
73+ --allowedTools mcp__github__get_issue,mcp__github__update_issue
0 commit comments