Skip to content

Commit 8fc6495

Browse files
committed
plaintext
chore(gh-pages): update lang script & workflow
1 parent b188e1a commit 8fc6495

File tree

2 files changed

+18
-40
lines changed

2 files changed

+18
-40
lines changed

.github/workflows/gh-pages.yml

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,43 +38,31 @@ jobs:
3838
run: |
3939
git diff --name-only HEAD~1 HEAD
4040
41-
- name: Dry Run Language Files
42-
id: dry_run_lang
43-
run: |
44-
export DEEPSEEK_API_KEY=${{ secrets.DEEPSEEK_API_KEY }}
45-
DRY_RUN_OUTPUT=$(python scripts/update_lang.py --dry_run)
46-
echo "$DRY_RUN_OUTPUT"
47-
48-
if [[ "$DRY_RUN_OUTPUT" == *'Total Markdown files to process: 0'* ]]; then
49-
echo "lang_updated=false" >> "$GITHUB_OUTPUT"
50-
else
51-
echo "lang_updated=true" >> "$GITHUB_OUTPUT"
52-
fi
53-
54-
- name: Update Language Files
55-
if: steps.dry_run_lang.outputs.lang_updated == 'true'
56-
run: |
57-
export DEEPSEEK_API_KEY=${{ secrets.DEEPSEEK_API_KEY }}
58-
python scripts/update_lang.py
59-
6041
- name: Clean Up Credentials
6142
run: |
6243
rm -f ./gha-creds-*.json
6344
64-
- name: Commit Language Files
45+
- name: Update Language Files
6546
if: steps.dry_run_lang.outputs.lang_updated == 'true'
6647
run: |
67-
git config user.name "github-actions[bot]"
68-
git config user.email "github-actions[bot]@users.noreply.github.com"
69-
git add _posts/**/*.md
70-
git diff --cached --quiet || git commit -m "chore(lang): Update language files"
71-
72-
git push || {
73-
echo "Push failed, attempting pull and merge"
74-
git pull --rebase
75-
git push
76-
}
48+
UPDATE_LANG_OUTPUT=$(python scripts/update_lang.py --max_files 1 --model mistral | grep "Total Markdown files to process:")
49+
echo "$UPDATE_LANG_OUTPUT"
50+
if [[ "$UPDATE_LANG_OUTPUT" == *'Total Markdown files to process: 0'* ]]; then
51+
echo "No language files to update."
52+
else
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
git add _posts/**/*.md
56+
git diff --cached --quiet || git commit -m "chore(lang): Update language files"
57+
58+
git push || {
59+
echo "Push failed, attempting pull and merge"
60+
git pull --rebase
61+
git push
62+
}
63+
fi
7764
env:
65+
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
7866
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7967

8068
- name: Dry Run Pdf Files
@@ -139,11 +127,6 @@ jobs:
139127
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
140128
run: sudo apt-get update && sudo apt-get install -y pandoc
141129

142-
- name: Clean Up Credentials
143-
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
144-
run: |
145-
rm -f ./gha-creds-*.json
146-
147130
- name: Run Pdf-Pipeline.py
148131
if: steps.dry_run_pdf.outputs.pdf_updated == 'true'
149132
run: |

scripts/update_lang.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,11 @@ def main():
283283

284284
parser = argparse.ArgumentParser(description="Translate markdown files to a specified language.")
285285
parser.add_argument("--lang", type=str, default="all", help="Target language for translation (e.g., ja, es, all).")
286-
parser.add_argument("--dry_run", action="store_true", help="Perform a dry run without modifying files.")
287286
parser.add_argument("--file", type=str, default=None, help="Specific file to translate.")
288287
parser.add_argument("--max_files", type=int, default=None, help="Maximum number of files to process.")
289288
parser.add_argument("--model", type=str, default="deepseek", help="Model to use for translation (deepseek or mistral).")
290289
args = parser.parse_args()
291290
target_language = args.lang
292-
dry_run = args.dry_run
293291
input_file = args.file
294292
max_files = args.max_files
295293
model = args.model
@@ -308,9 +306,6 @@ def main():
308306
changed_files = changed_files[:max_files]
309307
total_files_to_process = len(changed_files)
310308

311-
if dry_run:
312-
print(f"Total Markdown files to process: {total_files_to_process}")
313-
return
314309

315310
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
316311
futures = []

0 commit comments

Comments
 (0)