File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : 翻译SystemPrompts到中文
2
+
3
+ on :
4
+ # 允许手动触发工作流
5
+ workflow_dispatch :
6
+
7
+ jobs :
8
+ translate :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ # 检出指定分支
13
+ - name : 检出仓库
14
+ uses : actions/checkout@v3
15
+ with :
16
+ ref : zh/SystemPrompts
17
+
18
+ # 安装Node.js环境
19
+ - name : 设置Node.js环境
20
+ uses : actions/setup-node@v3
21
+ with :
22
+ node-version : ' 20'
23
+
24
+ # 执行翻译任务
25
+ - name : 翻译Markdown文件
26
+ run : |
27
+ npx ai-markdown-translator -i ./SystemPrompts/ -l 中文 --openai-url https://api.302.ai/v1/chat/completions --api-key ${{ secrets.OPENAI_API_KEY_302AI }} --model claude-3-7-sonnet-latest -e md --log
28
+
29
+ # 提交更新
30
+ - name : 提交翻译后的文件到仓库
31
+ if : success() || failure() # 无论之前步骤成功与否都尝试提交
32
+ continue-on-error : true # 允许提交失败但继续执行
33
+ run : |
34
+ git config --local user.email "[email protected] "
35
+ git config --local user.name "GitHub Action"
36
+ git config advice.ignoredHook false
37
+ git add ./SystemPrompts/
38
+ git add ./log.md
39
+ git commit -m "翻译更新: SystemPrompts目录 $(date +%Y-%m-%d)" || echo "没有需要提交的更改"
40
+ git push origin zh/SystemPrompts
41
+ env :
42
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43
+
44
+ # 清理工作
45
+ - name : 清理旧的workflow运行记录
46
+ if : always() # 总是执行清理步骤
47
+ continue-on-error : true # 允许清理失败但不影响整体状态
48
+ uses : Mattraks/delete-workflow-runs@v2
49
+ with :
50
+ token : ${{ github.token }}
51
+ repository : ${{ github.repository }}
52
+ retain_days : 10
53
+ keep_minimum_runs : 6
You can’t perform that action at this time.
0 commit comments