|
1 |
| -name: Sync Crowdin Translations to Release candidate |
| 1 | +name: Sync Translations |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | schedule:
|
5 | 5 | - cron: '0 * * * *'
|
6 | 6 | workflow_dispatch:
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - download-translations: |
| 9 | + sync-translations: |
| 10 | + name: Sync Translations for release-candidate-${{ matrix.lang }} |
10 | 11 | runs-on: ubuntu-latest
|
| 12 | + |
11 | 13 | strategy:
|
12 | 14 | matrix:
|
13 |
| - lang: [ru] # , en, ja, ko, zh-cn |
| 15 | + lang: [ru, ko, ja, zh-CN] |
14 | 16 |
|
15 | 17 | steps:
|
16 |
| - - name: Checkout branch |
17 |
| - uses: actions/checkout@v4 |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v3 |
18 | 20 | with:
|
19 |
| - ref: release-candidate-${{ matrix.lang }} |
| 21 | + fetch-depth: 0 |
20 | 22 |
|
21 |
| - - name: Download translations from Crowdin |
22 |
| - uses: crowdin/github-action@v2 |
| 23 | + - name: Setup Node.js |
| 24 | + uses: actions/setup-node@v3 |
23 | 25 | with:
|
24 |
| - config: crowdin-oss.yml |
25 |
| - download_translations: true |
26 |
| - download_language: ${{ github.event.inputs.language }} |
27 |
| - crowdin_branch_name: release-candidate-${{ matrix.lang }} |
28 |
| - pull_request_title: 'New Crowdin Translations' |
29 |
| - pull_request_body: 'New Crowdin translations (${{ matrix.lang }})' |
30 |
| - pull_request_base_branch_name: 'release-candidate-${{ matrix.lang }}' |
31 |
| - env: |
32 |
| - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
33 |
| - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
34 |
| - CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} |
35 |
| - |
36 |
| - - name: Commit and push updates |
| 26 | + node-version: '20' |
| 27 | + |
| 28 | + - name: Install Crowdin CLI |
| 29 | + run: npm install -g @crowdin/cli |
| 30 | + |
| 31 | + - name: Download completed translations |
37 | 32 | run: |
|
38 |
| - git config user.name "Crowdin Bot" |
39 |
| - git config user.email "[email protected]" |
40 |
| - git add . |
41 |
| - git commit -m "Update ${{ matrix.lang }} translations from Crowdin" |
42 |
| - git push |
| 33 | + crowdin download --export-only-approved --branch main --config crowdin-oss.yml --language=${{ matrix.lang }} |
| 34 | +
|
| 35 | + - name: Configure Git |
| 36 | + run: | |
| 37 | + git config user.name "github-actions[bot]" |
| 38 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 39 | +
|
| 40 | + - name: Create translations branch |
| 41 | + run: | |
| 42 | + git checkout -B l10n-release-candidate-${{ matrix.lang }} |
| 43 | +
|
| 44 | + - name: Commit and push translations |
| 45 | + run: | |
| 46 | + git add i18n/${{ matrix.lang }} |
| 47 | + git diff --quiet --cached || ( \ |
| 48 | + git commit -m "chore: update ${{ matrix.lang }} translations" && \ |
| 49 | + git push -u origin l10n-release-candidate-${{ matrix.lang }} \ |
| 50 | + ) |
| 51 | +
|
| 52 | + - name: Create Pull Request |
| 53 | + uses: peter-evans/create-pull-request@v5 |
| 54 | + with: |
| 55 | + token: ${{ secrets.GH_TOKEN }} |
| 56 | + commit-message: "chore: update ${{ matrix.lang }} translations" |
| 57 | + branch: l10n-release-candidate-${{ matrix.lang }} |
| 58 | + base: release-candidate-${{ matrix.lang }} |
| 59 | + title: "Update ${{ matrix.lang }} translations — release-candidate-${{ matrix.lang }}" |
| 60 | + body: | |
| 61 | + This automated PR updates only the fully translated `${{ matrix.lang }}` files. |
| 62 | + labels: translation, automated |
0 commit comments