-
-
Notifications
You must be signed in to change notification settings - Fork 4
123 lines (109 loc) · 4.67 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
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:
runs-on: ubuntu-latest
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # 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@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
name: Install pnpm
id: pnpm-install
with:
run_install: false
- name: Install Node.js
if: github.event_name != 'pull_request' && !startsWith(github.ref_name, 'l10n_')
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version-file: .nvmrc
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install Crowdin
run: pnpm -g add @crowdin/cli
- 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_')
run: crowdin push sources -b ${{ steps.sanitizebranch.outputs.value }}
- name: Pull updated translations from Crowdin
if: (github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled'
run: crowdin pull -b ${{ steps.sanitizebranch.outputs.value }}
- 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@30aa174f53f67ecd5dc8e190dfbe46392202e5a5 # v16
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
run: |
echo 'Installing package dependencies'
pnpm install
echo 'Running prettier'
pnpm format
- name: 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@153407881ec5c347639a548ade7d8ad1d6740e38 # v5
with:
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
- name: Delete Crowdin Branch
if: github.event_name == 'pull_request' && github.ref_name != 'l10n_dev' && github.ref_name != 'dev'
run: crowdin branch delete ${{ steps.sanitizebranch.outputs.value }}