-
-
Notifications
You must be signed in to change notification settings - Fork 4
166 lines (149 loc) · 6.65 KB
/
crowdin.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Crowdin Action
on:
push:
branches-ignore:
- renovate/*
- l10n_*
pull_request:
types:
- closed
branches-ignore:
- main
- l10n_*
- renovate/*
workflow_dispatch:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: 0 8 * * *
jobs:
synchronize-with-crowdin:
name: Crowdin Actions
runs-on: ubuntu-latest
env:
HUSKY: 0
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6
with:
gpg_private_key: ${{ secrets.BOT_GPG_KEY }}
git_user_signingkey: true
git_config_global: true
git_commit_gpgsign: true
git_committer_name: 'InReach [bot]'
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
name: Install pnpm
id: pnpm-install
with:
run_install: |
args: [--global, "@crowdin/cli"]
- name: Install Node.js
if: github.event_name != 'pull_request' && !startsWith(github.ref_name, 'l10n_')
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version-file: .nvmrc
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Remove Jira ticket ID from branch name
id: branchregex
uses: ashley-taylor/regex-property-action@eeec905bf940ec1c65ff777402c57f786368d9bc # v1.4
with:
value: ${{ github.ref_name }}
regex: (IN|PLI)-\d+
flags: gi
replacement: $1-xxx
- name: Sanitize github branch name
id: sanitizebranch
uses: ashley-taylor/regex-property-action@eeec905bf940ec1c65ff777402c57f786368d9bc # v1.4
with:
value: ${{ github.head_ref || github.ref_name}}
regex: '[\\/:*?"<>|>]'
flags: gi
replacement: '_'
- name: Push sources to Crowdin
if: github.event_name != 'pull_request' && !startsWith(github.ref_name, 'l10n_')
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin push sources -b ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Synchronize sources to Crowdin
if: steps.sanitizebranch.outputs.value == 'main'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin push sources -b ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Pull updated translations from Crowdin
if: (github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin pull -b ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Check for updated files
if: (github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled'
uses: tj-actions/verify-changed-files@d774a4c7ebe335445d79c7b44138f56a76058ba0 # v19
id: verify-changed-files
with:
files: '**/locales/*/*.json'
- name: Format json files
if: ((github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled') && steps.verify-changed-files.outputs.files_changed
working-directory: apps/app
id: run-prettier
run: |
echo 'Installing package dependencies'
pnpm install
echo 'Running prettier'
pnpm format
- name: Get files to commit
if: steps.run-prettier.conclusion == 'success'
uses: tj-actions/verify-changed-files@d774a4c7ebe335445d79c7b44138f56a76058ba0 # v19
id: get-pending-files
with:
separator: <br>
- name: Commit files
id: commit-files
if: ((github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled') && steps.verify-changed-files.outputs.files_changed
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6
with:
token: ${{ secrets.GH_ACT_PAT }}
commit-message: Updated translations from Crowdin
committer: 'InReach [bot] <[email protected]>'
author: 'InReach [bot] <[email protected]>'
branch: ${{ format('l10n_{0}',steps.branchregex.outputs.value) }}
base: ${{ github.ref_name }}
title: 'chore(i18n): Updated translations from Crowdin'
labels: |
translations
kodiak: merge.method = 'squash'
automerge
delete-branch: true
add-paths: |
./**/locales/*/*.json
- name: Generate job summary
id: generate-job-summary
if: steps.commit-files.conclusion == 'success'
run: |
echo "# Job Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Pull request ${{steps.commit-files.outputs.pull-request-number}} has been ${{steps.commit-files.outputs.pull-request-operation}}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Changed files:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.get-pending-files.outputs.changed_files }}" >> $GITHUB_STEP_SUMMARY
- name: Delete Crowdin Branch
if: github.event_name == 'pull_request' && github.ref_name != 'l10n_dev' && steps.sanitizebranch.outputs.value != 'dev' && steps.sanitizebranch.outputs.value != 'main'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin branch delete ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Generate OTA Release
if: github.event_name == 'schedule'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin distribution release ${{ secrets.CROWDIN_OTA_HASH }} --no-progress --verbose