-
-
Notifications
You must be signed in to change notification settings - Fork 15
79 lines (69 loc) · 2.46 KB
/
crowdin-download.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Crowdin Download Translations
on:
workflow_dispatch:
schedule:
- cron: "0 */6 * * *"
jobs:
download:
environment: "prod"
name: Synchronize with Crowdin
runs-on: ubuntu-latest
env:
UPDATE_BRANCH: ci/update-locale
BASE_BRANCH: master
steps:
- name: Setup Node
uses: actions/setup-node@v4.0.0
with:
node-version: 18
- name: Install Dependencies
run: |
yarn global add i18next-parser
- name: Checkout
uses: actions/checkout@v4
- name: Change branch to the update branch
id: commits
run: |
git pull
echo "::set-output name=base::$(git rev-parse origin/${{ env.BASE_BRANCH }})"
git rev-parse --quiet origin/${{ env.UPDATE_BRANCH }} || git branch ${{ env.UPDATE_BRANCH }}
git checkout ${{ env.UPDATE_BRANCH }}
echo "::set-output name=update::$(git rev-parse ${{ env.UPDATE_BRANCH }}~)"
- name: Use the base branch instead
if: ${{ steps.commits.outputs.base != steps.commits.outputs.update }}
run: |
git checkout ${{ env.BASE_BRANCH }}
- name: Download Crowdin Translations
uses: crowdin/github-action@v1
with:
download_translations: true
upload_sources: false
upload_translations: false
create_pull_request: false
push_translations: false
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Organize translations
run: |
sudo chown -R $(id -u):$(id -g) packages/**/locales/*
sudo chown -R $(id -u):$(id -g) packages/twitch/**/locales/*
i18next -c 'services/crowdin/src/i18next-parser.config.js'
- name: Count lines
id: count
run: |
echo "::set-output name=lines::$(git status --porcelain | wc -l)"
- name: Create Pull Request
id: cpr
if: ${{ steps.count.outputs.lines != '0' }}
uses: peter-evans/create-pull-request@v5.0.2
with:
title: "[CI] New Crowdin Translations"
body: The latest approved translations from Crowdin
base: ${{ env.BASE_BRANCH }}
branch: ${{ env.UPDATE_BRANCH }}
commit-message: 💅 i18n update from crowdin
delete-branch: true
add-paths: |
packages/**/locales/*
packages/twitch/**/locales/*