Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae4ba3c

Browse files
authored
Add a new GH Actions job to automatically update translated document pagse (#598)
This pull request adds a new GitHub Actions job to automate thetranslation of document pages.- Before this job can run, **OPENAI_API_KEY must be added to the projectsecrets.**- It typically takes 8–10 minutes using the o3 model, so the job isconfigured to run only when there are changes under docs/ or inmkdocs.yml.- The job commits and pushes the translated changes, but it does notdeploy the documents to GitHub Pages. If we think it’s better to deploythe latest changes automatically as well, I’m happy to update theworkflow. (Personally, I don’t think it’s necessary, since the changeswill be deployed with the next deployment job execution)
1 parentaeb4381 commitae4ba3c

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

‎.github/workflows/update-docs.yml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name:"Update Translated Docs"
2+
3+
# This GitHub Actions job automates the process of updating all translated document pages. Please note the following:
4+
# 1. The translation results may vary each time; some differences in detail are expected.
5+
# 2. When you add a new page to the left-hand menu, **make sure to manually update mkdocs.yml** to include the new item.
6+
# 3. If you switch to a different LLM (for example, from o3 to a newer model), be sure to conduct thorough testing before making the switch.
7+
8+
on:
9+
push:
10+
branches:
11+
-main
12+
paths:
13+
-'docs/**'
14+
-mkdocs.yml
15+
16+
jobs:
17+
update-docs:
18+
name:Build and Push Translated Docs
19+
runs-on:ubuntu-latest
20+
timeout-minutes:20
21+
env:
22+
PROD_OPENAI_API_KEY:${{ secrets.PROD_OPENAI_API_KEY }}
23+
steps:
24+
-name:Checkout repository
25+
uses:actions/checkout@v3
26+
with:
27+
fetch-depth:0
28+
-name:Setup uv
29+
uses:astral-sh/setup-uv@v5
30+
with:
31+
enable-cache:true
32+
-name:Install dependencies
33+
run:make sync
34+
-name:Build full docs
35+
run:make build-full-docs
36+
37+
-name:Commit and push changes
38+
run:|
39+
git config user.name "github-actions[bot]"
40+
git config user.email "github-actions[bot]@users.noreply.github.com"
41+
git add docs/
42+
if [ -n "$(git status --porcelain)" ]; then
43+
git commit -m "Update all translated document pages"
44+
git push
45+
else
46+
echo "No changes to commit"
47+
fi

‎docs/scripts/translate_docs.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
}
3131

3232
# Initialize OpenAI client
33-
openai_client=OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
33+
api_key=os.getenv("PROD_OPENAI_API_KEY")oros.getenv("OPENAI_API_KEY")
34+
openai_client=OpenAI(api_key=api_key)
3435

3536
# Define dictionaries for translation control
3637
do_not_translate= [

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp