Skip to content

Commit 8fd3247

Browse files
committed
i18n gha updates
1 parent 616b36e commit 8fd3247

File tree

3 files changed

+24
-38
lines changed

3 files changed

+24
-38
lines changed
Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# This workflow runs every Saturday @ 1900 UTC (NOON PST)
22
name: i18n download bot
3+
34
on:
45
workflow_dispatch:
56
schedule:
67
- cron: "0 19 * * 6"
8+
79
jobs:
8-
build:
10+
download:
911
runs-on: ubuntu-latest
1012
steps:
1113
- name: Checkout DIM
@@ -14,16 +16,7 @@ jobs:
1416
ref: ${{ github.head_ref }}
1517
token: ${{ secrets.I18N_PAT }}
1618

17-
- uses: pnpm/action-setup@v4
18-
19-
- name: Setup Node
20-
uses: actions/setup-node@v6
21-
with:
22-
node-version-file: '.nvmrc'
23-
cache: pnpm
24-
25-
- name: Install
26-
run: pnpm install --frozen-lockfile --prefer-offline
19+
- uses: ./.github/actions/setup-pnpm
2720

2821
- name: Download updated i18n files
2922
uses: crowdin/[email protected]
@@ -40,30 +33,31 @@ jobs:
4033
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
4134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4235

43-
- name: sort locale json
36+
- name: Sort locale JSON files
4437
run: |
4538
allLocales=("en" "de" "es" "esMX" "fr" "it" "ja" "ko" "pl" "ptBR" "ru" "zhCHS" "zhCHT")
46-
for lang in ${allLocales[@]}; do
47-
jq -S . src/locale/$lang.json > src/locale/sorted_$lang.json && mv src/locale/sorted_$lang.json src/locale/$lang.json
39+
for lang in "${allLocales[@]}"; do
40+
jq -S . "src/locale/$lang.json" > "src/locale/sorted_$lang.json" && \
41+
mv "src/locale/sorted_$lang.json" "src/locale/$lang.json"
4842
done
4943
50-
- name: build browsercheck utils
44+
- name: Build browsercheck utils
5145
run: pnpm bcu
5246

53-
- name: porcelain check
47+
- name: Check for changes
5448
uses: dorny/paths-filter@v3
5549
id: filter
5650
with:
5751
base: HEAD
5852
filters: |
5953
changed:
60-
- '**'
54+
- 'src/locale/*.json'
6155
6256
- name: Commit files
63-
if: steps.filter.outputs.changed
57+
if: steps.filter.outputs.changed == 'true'
6458
uses: stefanzweifel/git-auto-commit-action@v7
6559
with:
66-
commit_message: i18n
60+
commit_message: "i18n: Update translations from Crowdin"
6761
commit_user_name: DIM i18n Bot
6862
commit_user_email: [email protected]
6963
commit_author: DIM i18n Bot <[email protected]>

.github/workflows/i18n-bot-upload.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow runs whenever locale/en.json is updated on the master branch
22
# It updates crowdin with new translation strings
3-
# and notifies the #i18n @i18n in Discord of the new translations.
43
name: i18n upload bot
4+
55
on:
66
workflow_dispatch:
77
push:
@@ -10,16 +10,18 @@ on:
1010
branches: [master]
1111

1212
jobs:
13-
build:
13+
upload:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout DIM
1717
uses: actions/checkout@v6
1818

1919
- name: Sort en.json
20-
run: dimJSON="$(jq -S . src/locale/en.json)" && echo "${dimJSON}" > src/locale/en.json
20+
run: |
21+
sorted=$(jq -S . src/locale/en.json)
22+
echo "$sorted" > src/locale/en.json
2123
22-
- name: Upload updated en.json to crowdin
24+
- name: Upload en.json to Crowdin
2325
uses: crowdin/[email protected]
2426
with:
2527
upload_sources: true
@@ -31,7 +33,7 @@ jobs:
3133
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
3234
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3335

34-
- name: porcelain check
36+
- name: Check for changes
3537
uses: dorny/paths-filter@v3
3638
id: filter
3739
with:

.github/workflows/i18n-update.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,20 @@ on:
88
- 'src/locale/en.json'
99

1010
jobs:
11-
i18n-update:
11+
update:
1212
runs-on: ubuntu-latest
13-
1413
steps:
1514
- uses: actions/checkout@v6
1615
with:
1716
fetch-depth: 3
1817
token: ${{ secrets.I18N_PAT }}
1918

20-
- uses: pnpm/action-setup@v4
21-
22-
- name: Setup Node
23-
uses: actions/setup-node@v6
24-
with:
25-
node-version-file: '.nvmrc'
26-
cache: pnpm
27-
28-
- name: Install
29-
run: pnpm install --frozen-lockfile --prefer-offline
19+
- uses: ./.github/actions/setup-pnpm
3020

31-
- name: pnpm i18n
21+
- name: Run i18n update
3222
run: pnpm i18n
3323

3424
- name: Commit files
3525
uses: stefanzweifel/git-auto-commit-action@v7
3626
with:
37-
commit_message: Apply i18n updates
27+
commit_message: "i18n: Apply automated updates"

0 commit comments

Comments
 (0)