Skip to content

Commit 00a7f94

Browse files
feat: auto approve en-US strings (#16)
1 parent fa11b23 commit 00a7f94

4 files changed

Lines changed: 1265 additions & 1 deletion

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
# Ensures that en_US translations in Crowdin exactly mirror the source strings,
3+
# and automatically approves them.
4+
#
5+
# For each configured project the script will:
6+
# • Fetch all source strings.
7+
# • For each source string, verify that the en_US translation matches.
8+
# • Add the translation if it is missing.
9+
# • Replace the translation if it is stale (does not match the source).
10+
# • Approve the en_US translation if it is not already approved.
11+
#
12+
# Required GitHub repository configuration:
13+
# secrets.CROWDIN_TOKEN – Crowdin personal access token
14+
# vars.CROWDIN_PROJECT_IDS – Comma-separated list of Crowdin project IDs
15+
# (e.g. "123456" or "123456,789012")
16+
17+
name: Sync Crowdin en_US Translations
18+
permissions: {}
19+
20+
on:
21+
schedule:
22+
# Run every 6 hours so translations stay in sync with source strings.
23+
- cron: '0 */6 * * *'
24+
workflow_dispatch: # Allow ad-hoc manual runs
25+
26+
# Only one sync at a time; never cancel an in-progress run.
27+
concurrency:
28+
group: crowdin-en-us-sync
29+
cancel-in-progress: false
30+
31+
jobs:
32+
sync:
33+
name: Sync en_US translations to match source strings
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
if: github.repository_owner == 'LizardByte' # don't run for forks
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
43+
- name: Set up Node.js
44+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
45+
with:
46+
node-version: 'node'
47+
48+
- name: Install dependencies
49+
run: npm install --ignore-scripts
50+
51+
- name: Sync en_US translations
52+
env:
53+
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
54+
CROWDIN_PROJECT_IDS: ${{ vars.CROWDIN_PROJECT_IDS }}
55+
run: node src/sync-crowdin-en-us.js

.github/workflows/crowdin-issues-sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
name: Sync Crowdin issues to GitHub Issues
4040
runs-on: ubuntu-latest
4141
permissions:
42-
contents: read # needed by the checkout action
42+
contents: read
4343
if: github.repository_owner == 'LizardByte' # don't run for forks
4444

4545
steps:

0 commit comments

Comments
 (0)