Skip to content

Commit 17cf728

Browse files
authored
improvement(gh): fix i18n github action to run on merge to staging (#1350)
* update infra and remove railway * improvement(ci): fix i18n github action * Revert "update infra and remove railway" This reverts commit abfa2f8.
1 parent 3122b50 commit 17cf728

File tree

1 file changed

+61
-36
lines changed

1 file changed

+61
-36
lines changed

.github/workflows/i18n.yml

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ name: 'Auto-translate Documentation'
22

33
on:
44
push:
5-
branches: [ main ]
6-
paths:
7-
- 'apps/docs/content/docs/en/**'
8-
- 'apps/docs/i18n.json'
9-
pull_request:
10-
branches: [ main ]
5+
branches: [ staging ]
116
paths:
127
- 'apps/docs/content/docs/en/**'
138
- 'apps/docs/i18n.json'
149
workflow_dispatch: # Allow manual triggers
1510

11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
1615
jobs:
1716
translate:
1817
runs-on: ubuntu-latest
@@ -24,12 +23,12 @@ jobs:
2423
with:
2524
token: ${{ secrets.GITHUB_TOKEN }}
2625
fetch-depth: 0
27-
26+
2827
- name: Setup Bun
29-
uses: oven-sh/setup-bun@v1
28+
uses: oven-sh/setup-bun@v2
3029
with:
3130
bun-version: latest
32-
31+
3332
- name: Run Lingo.dev translations
3433
env:
3534
LINGODOTDEV_API_KEY: ${{ secrets.LINGODOTDEV_API_KEY }}
@@ -50,38 +49,56 @@ jobs:
5049
echo "changes=false" >> $GITHUB_OUTPUT
5150
fi
5251
53-
- name: Commit and push translation updates
52+
- name: Create Pull Request with translations
5453
if: steps.changes.outputs.changes == 'true'
55-
run: |
56-
cd apps/docs
57-
git add content/docs/es/ content/docs/fr/ content/docs/zh/ i18n.lock
58-
git commit -m "feat: update translations"
59-
git push origin ${{ github.ref_name }}
60-
61-
- name: Create Pull Request (for feature branches)
62-
if: steps.changes.outputs.changes == 'true' && github.event_name == 'pull_request'
6354
uses: peter-evans/create-pull-request@v5
6455
with:
6556
token: ${{ secrets.GITHUB_TOKEN }}
66-
commit-message: "feat: update translations"
57+
commit-message: "feat(i18n): update translations"
6758
title: "🌐 Auto-update translations"
6859
body: |
6960
## Summary
70-
Automated translation updates for documentation.
61+
Automated translation updates triggered by changes to documentation.
62+
63+
This PR was automatically created after content changes were made, updating translations for all supported languages using Lingo.dev AI translation engine.
64+
65+
**Original trigger**: ${{ github.event.head_commit.message }}
66+
**Commit**: ${{ github.sha }}
67+
**Workflow**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
7168
72-
- Updated translations for modified English content
73-
- Generated using Lingo.dev AI translation
74-
- Maintains consistency with source documentation
69+
## Type of Change
70+
- [ ] Bug fix
71+
- [ ] New feature
72+
- [ ] Breaking change
73+
- [x] Documentation
74+
- [ ] Other: ___________
7575
76-
## Test Plan
77-
- [ ] Verify translated content accuracy
78-
- [ ] Check that all links and references work correctly
79-
- [ ] Ensure formatting and structure are preserved
80-
branch: auto-translations
81-
base: ${{ github.base_ref }}
76+
## Testing
77+
This PR includes automated translations for modified English documentation content:
78+
- 🇪🇸 Spanish (es) translations
79+
- 🇫🇷 French (fr) translations
80+
- 🇨🇳 Chinese (zh) translations
81+
82+
**What reviewers should focus on:**
83+
- Verify translated content accuracy and context
84+
- Check that all links and references work correctly in translated versions
85+
- Ensure formatting, code blocks, and structure are preserved
86+
- Validate that technical terms are appropriately translated
87+
88+
## Checklist
89+
- [x] Code follows project style guidelines (automated translation)
90+
- [x] Self-reviewed my changes (automated process)
91+
- [ ] Tests added/updated and passing
92+
- [x] No new warnings introduced
93+
- [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)
94+
95+
## Screenshots/Videos
96+
<!-- Translation changes are text-based - no visual changes expected -->
97+
<!-- Reviewers should check the documentation site renders correctly for all languages -->
98+
branch: auto-translate/staging-merge-${{ github.run_id }}
99+
base: staging
82100
labels: |
83101
i18n
84-
auto-generated
85102
86103
verify-translations:
87104
needs: translate
@@ -91,26 +108,30 @@ jobs:
91108
steps:
92109
- name: Checkout repository
93110
uses: actions/checkout@v4
94-
111+
with:
112+
ref: staging
113+
95114
- name: Setup Bun
96-
uses: oven-sh/setup-bun@v1
115+
uses: oven-sh/setup-bun@v2
97116
with:
98117
bun-version: latest
99-
118+
100119
- name: Install dependencies
101120
run: |
102121
cd apps/docs
103122
bun install
104-
123+
105124
- name: Build documentation to verify translations
106125
run: |
107126
cd apps/docs
108127
bun run build
109-
128+
110129
- name: Report translation status
111130
run: |
112131
cd apps/docs
113132
echo "## Translation Status Report" >> $GITHUB_STEP_SUMMARY
133+
echo "**Triggered by merge to staging branch**" >> $GITHUB_STEP_SUMMARY
134+
echo "" >> $GITHUB_STEP_SUMMARY
114135
115136
en_count=$(find content/docs/en -name "*.mdx" | wc -l)
116137
es_count=$(find content/docs/es -name "*.mdx" 2>/dev/null | wc -l || echo 0)
@@ -121,6 +142,10 @@ jobs:
121142
fr_percentage=$((fr_count * 100 / en_count))
122143
zh_percentage=$((zh_count * 100 / en_count))
123144
145+
echo "### Coverage Statistics" >> $GITHUB_STEP_SUMMARY
146+
echo "- **🇬🇧 English**: $en_count files (source)" >> $GITHUB_STEP_SUMMARY
124147
echo "- **🇪🇸 Spanish**: $es_count/$en_count files ($es_percentage%)" >> $GITHUB_STEP_SUMMARY
125148
echo "- **🇫🇷 French**: $fr_count/$en_count files ($fr_percentage%)" >> $GITHUB_STEP_SUMMARY
126-
echo "- **🇨🇳 Chinese**: $zh_count/$en_count files ($zh_percentage%)" >> $GITHUB_STEP_SUMMARY
149+
echo "- **🇨🇳 Chinese**: $zh_count/$en_count files ($zh_percentage%)" >> $GITHUB_STEP_SUMMARY
150+
echo "" >> $GITHUB_STEP_SUMMARY
151+
echo "🔄 **Auto-translation PR**: Check for new pull request with updated translations" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)