-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (44 loc) · 1.38 KB
/
Copy pathtransifex-sync.yml
File metadata and controls
55 lines (44 loc) · 1.38 KB
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
name: Sync Transifex Translations
on:
schedule:
- cron: '0 3 * * *' # Daily at 03:00 UTC
workflow_dispatch:
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Transifex CLI
run: |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
sudo mv tx /usr/local/bin/
- name: Push source strings to Transifex
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: tx push --source --force
- name: Pull translations (minimum 20%)
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: tx pull --all --force --minimum-perc=20
- name: Install gettext
run: sudo apt-get install -y gettext
- name: Compile .mo files
run: |
for po in po/*.po; do
[ -f "$po" ] || continue
lang=$(basename "$po" .po)
msgfmt -o "po/${lang}.mo" "$po"
done
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add po/
if git diff --cached --quiet; then
echo "No translation changes"
else
git commit -m "i18n: sync translations from Transifex"
git push
fi