mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-07 22:24:06 -05:00
180 lines
6.9 KiB
YAML
180 lines
6.9 KiB
YAML
name: 'Auto-translate Documentation'
|
|
|
|
on:
|
|
push:
|
|
branches: [ staging ]
|
|
paths:
|
|
- 'apps/docs/content/docs/en/**'
|
|
- 'apps/docs/i18n.json'
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
translate:
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
if: github.actor != 'github-actions[bot]' # Prevent infinite loops
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GH_PAT }}
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.3
|
|
|
|
- name: Cache Bun dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
**/node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Run Lingo.dev translations
|
|
env:
|
|
LINGODOTDEV_API_KEY: ${{ secrets.LINGODOTDEV_API_KEY }}
|
|
run: |
|
|
cd apps/docs
|
|
bunx lingo.dev@latest i18n
|
|
|
|
- name: Check for translation changes
|
|
id: changes
|
|
run: |
|
|
cd apps/docs
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
|
|
if [ -n "$(git status --porcelain content/docs)" ]; then
|
|
echo "changes=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "changes=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Create Pull Request with translations
|
|
if: steps.changes.outputs.changes == 'true'
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
token: ${{ secrets.GH_PAT }}
|
|
commit-message: "feat(i18n): update translations"
|
|
title: "feat(i18n): update translations"
|
|
body: |
|
|
## Summary
|
|
Automated translation updates triggered by changes to documentation.
|
|
|
|
This PR was automatically created after content changes were made, updating translations for all supported languages using Lingo.dev AI translation engine.
|
|
|
|
**Original trigger**: ${{ github.event.head_commit.message }}
|
|
**Commit**: ${{ github.sha }}
|
|
**Workflow**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
## Type of Change
|
|
- [ ] Bug fix
|
|
- [ ] New feature
|
|
- [ ] Breaking change
|
|
- [x] Documentation
|
|
- [ ] Other: ___________
|
|
|
|
## Testing
|
|
This PR includes automated translations for modified English documentation content:
|
|
- 🇪🇸 Spanish (es) translations
|
|
- 🇫🇷 French (fr) translations
|
|
- 🇨🇳 Chinese (zh) translations
|
|
- 🇯🇵 Japanese (ja) translations
|
|
- 🇩🇪 German (de) translations
|
|
|
|
**What reviewers should focus on:**
|
|
- Verify translated content accuracy and context
|
|
- Check that all links and references work correctly in translated versions
|
|
- Ensure formatting, code blocks, and structure are preserved
|
|
- Validate that technical terms are appropriately translated
|
|
|
|
## Checklist
|
|
- [x] Code follows project style guidelines (automated translation)
|
|
- [x] Self-reviewed my changes (automated process)
|
|
- [ ] Tests added/updated and passing
|
|
- [x] No new warnings introduced
|
|
- [x] I confirm that I have read and agree to the terms outlined in the [Contributor License Agreement (CLA)](./CONTRIBUTING.md#contributor-license-agreement-cla)
|
|
|
|
## Screenshots/Videos
|
|
<!-- Translation changes are text-based - no visual changes expected -->
|
|
<!-- Reviewers should check the documentation site renders correctly for all languages -->
|
|
branch: auto-translate/staging-merge-${{ github.run_id }}
|
|
base: staging
|
|
labels: |
|
|
i18n
|
|
|
|
verify-translations:
|
|
needs: translate
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
if: always() # Run even if translation fails
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: staging
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.3
|
|
|
|
- name: Cache Bun dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
**/node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
cd apps/docs
|
|
bun install --frozen-lockfile
|
|
|
|
- name: Build documentation to verify translations
|
|
run: |
|
|
cd apps/docs
|
|
bun run build
|
|
|
|
- name: Report translation status
|
|
run: |
|
|
cd apps/docs
|
|
echo "## Translation Status Report" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Triggered by merge to staging branch**" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
|
|
en_count=$(find content/docs/en -name "*.mdx" | wc -l)
|
|
es_count=$(find content/docs/es -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
|
fr_count=$(find content/docs/fr -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
|
zh_count=$(find content/docs/zh -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
|
ja_count=$(find content/docs/ja -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
|
de_count=$(find content/docs/de -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
|
|
|
es_percentage=$((es_count * 100 / en_count))
|
|
fr_percentage=$((fr_count * 100 / en_count))
|
|
zh_percentage=$((zh_count * 100 / en_count))
|
|
ja_percentage=$((ja_count * 100 / en_count))
|
|
de_percentage=$((de_count * 100 / en_count))
|
|
|
|
echo "### Coverage Statistics" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **🇬🇧 English**: $en_count files (source)" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **🇪🇸 Spanish**: $es_count/$en_count files ($es_percentage%)" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **🇫🇷 French**: $fr_count/$en_count files ($fr_percentage%)" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **🇨🇳 Chinese**: $zh_count/$en_count files ($zh_percentage%)" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **🇯🇵 Japanese**: $ja_count/$en_count files ($ja_percentage%)" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **🇩🇪 German**: $de_count/$en_count files ($de_percentage%)" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "🔄 **Auto-translation PR**: Check for new pull request with updated translations" >> $GITHUB_STEP_SUMMARY |