Skip to content

Commit 7fd48c6

Browse files
authored
ci(docs): automate docs translation (#254)
1 parent fba44d9 commit 7fd48c6

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/update-docs.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: "Update Translated Docs"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '!docs/src/content/docs/ja/**'
10+
11+
jobs:
12+
update-docs:
13+
if: "!contains(github.event.head_commit.message, 'Update all translated document pages')"
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
22+
with:
23+
version: 10.13.1
24+
run_install: false
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
cache: 'pnpm'
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Translate docs
34+
env:
35+
OPENAI_API_KEY: ${{ secrets.PROD_OPENAI_API_KEY }}
36+
run: pnpm docs:translate
37+
38+
- name: Commit changes
39+
id: commit
40+
run: |
41+
git config user.name "github-actions[bot]"
42+
git config user.email "github-actions[bot]@users.noreply.github.com"
43+
git add docs/
44+
if [ -n "$(git status --porcelain)" ]; then
45+
git commit -m "Update all translated document pages"
46+
echo "committed=true" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "No changes to commit"
49+
echo "committed=false" >> "$GITHUB_OUTPUT"
50+
fi
51+
52+
- name: Create Pull Request
53+
if: steps.commit.outputs.committed == 'true'
54+
uses: peter-evans/create-pull-request@v6
55+
with:
56+
commit-message: "Update all translated document pages"
57+
title: "Update all translated document pages"
58+
body: "Automated update of translated documentation"
59+
branch: update-translated-docs-${{ github.run_id }}
60+
delete-branch: true

0 commit comments

Comments
 (0)