Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Refactor translation workflow to separate translation checks and manual triggers, enhancing clarity and automation. Update job names and permissions for improved workflow management.

Bill Yang88c95a6fb0a7
diff --git a/.github/workflows/translate.yml b/.github/workflows/translate.yml
index 13d3b08f1..4313776a6 100644
--- a/.github/workflows/translate.yml
+++ b/.github/workflows/translate.yml
@@ -6,15 +6,15 @@ on:
paths:
- "client/src/**/*.ts"
- "client/src/**/*.tsx"
- workflow_dispatch: # Allow manual trigger
+ workflow_dispatch:
jobs:
- translate:
+ check:
+ if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
- contents: write
- pull-requests: write
- id-token: write
+ actions: write
+ contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -36,7 +36,6 @@ jobs:
id: changes
run: |
cd client/messages
- # Check if any non-English file has empty string values or is missing keys from en.json
EN_KEYS=$(python3 -c "import json; f=open('en.json'); d=json.load(f); print(len(d))")
NEEDS_TRANSLATION=false
for file in zh.json ja.json de.json pl.json pt.json it.json fr.json ko.json es.json; do
@@ -49,9 +48,37 @@ jobs:
done
echo "has_changes=$NEEDS_TRANSLATION" >> "$GITHUB_OUTPUT"
- - name: Run Claude Code
+ - name: Trigger translation workflow
if: steps.changes.outputs.has_changes == 'true'
- id: claude
+ run: gh workflow run translate.yml --ref master
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ translate:
+ if: github.event_name == 'workflow_dispatch'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ pull-requests: write
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 1
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+
+ - name: Install dependencies
+ run: cd client && npm ci
+
+ - name: Extract messages
+ run: cd client && node scripts/extract-messages.mjs
+
+ - name: Run Claude Code
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}