Skip to content

Commit 69d6a46

Browse files
committed
feat: crowdin cd v2
1 parent 6c066cc commit 69d6a46

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

.github/workflows/get-translations.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
name: Import Crowdin translations
1+
name: Crowdin CI
22

33
on:
44
schedule:
55
- cron: "20 16 1 * *" # Runs at 4:20 PM on the first day of every month
6-
workflow_dispatch:
6+
workflow_dispatch: # Can be dispatched manually
77

88
jobs:
9-
create_pr:
9+
create_approved_language_bucket_prs:
1010
runs-on: ubuntu-latest
1111
steps:
12+
# Set up environment
1213
- name: Check out code
1314
uses: actions/checkout@v3
1415

@@ -31,16 +32,34 @@ jobs:
3132
- name: Fetch latest dev
3233
run: git fetch origin dev
3334

35+
- name: Authenticate GitHub CLI
36+
run: |
37+
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
38+
39+
# Build and prepare translations
40+
- name: Build Crowdin project
41+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts
42+
env:
43+
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
44+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
45+
46+
- name: Sleep while Crowdin build finishes
47+
run: sleep 3600 # in seconds (1 hour)
48+
49+
- name: Get latest translation bucket directory ids
50+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getBucketDirectoryIds.ts
51+
env:
52+
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
53+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
54+
55+
# Import approved translations
3456
- name: Get translations
3557
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getTranslations.ts
3658
env:
3759
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
3860
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
3961

40-
- name: Authenticate GitHub CLI
41-
run: |
42-
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
43-
62+
# Post updates as language-specific PRs
4463
- name: Process commits and post PRs by language
4564
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/postLangPRs.ts
4665
env:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import getAndSaveDirectories from "../source-files/fetchAndSaveDirectories"
2+
3+
async function main() {
4+
await getAndSaveDirectories()
5+
}
6+
7+
main()
8+
9+
export default main

0 commit comments

Comments
 (0)