-
-
Notifications
You must be signed in to change notification settings - Fork 133
45 lines (38 loc) · 1.07 KB
/
translate-posts.yml
File metadata and controls
45 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Auto Translate Posts
on:
push:
paths:
- "src/pages/posts/**.md"
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm install axios
- name: Run Translation Script
env:
GROK_API_KEY: ${{ secrets.GROK_API_KEY }}
run: node scripts/translate_posts.js
- name: Commit and Push Changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add src/pages/en/posts/
# Only commit if there are changes
if ! git diff --staged --quiet; then
git commit -m "feat: auto translate new posts [skip ci]"
git push
else
echo "No changes to commit"
fi