-
Notifications
You must be signed in to change notification settings - Fork 4.9k
62 lines (50 loc) · 1.94 KB
/
crowdin-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Crowdin CI
on:
schedule:
- cron: "20 4 1 * *" # Runs at 4:20 AM on the first day of every month
workflow_dispatch: # Can be dispatched manually
push: # For testing purposes only; remove for production
branches:
- crowdin-ci-test
jobs:
create_approved_language_bucket_prs:
runs-on: ubuntu-latest
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
# Set up environment
- name: Check out code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Install ts-node
run: yarn global add ts-node
- name: Set up git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Fetch latest dev
run: git fetch origin dev
# Build and download translations to ./crowdin
- name: Build Crowdin project
uses: crowdin/github-action@v1
with:
config: "./crowdin.yaml"
download_translations: true
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
api_token: ${{ secrets.CROWDIN_API_KEY }}
# Prepare bucket ids
- name: Get latest translation bucket directory ids
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getBucketDirectoryIds.ts
# Import approved translations
- name: Import approved translations
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/importApprovedTranslations.ts
# Post updates as language-specific PRs
- name: Process commits and post PRs by language
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/postLangPRs.ts