Skip to content

Commit 8b61df5

Browse files
committed
Add a workflow to synchronisation translations
1 parent d2eb7a5 commit 8b61df5

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/transifex.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Synchronise translations
2+
3+
on:
4+
schedule:
5+
# 22:38 GMT, every Sunday. Chosen to be a random time.
6+
- cron: "38 22 * * SUN"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
push:
14+
if: github.repository_owner == 'sphinx-doc'
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3
23+
- name: Install transifex client
24+
run: |
25+
mkdir -p /tmp/tx_cli && cd $_
26+
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
27+
shell: bash
28+
- name: Install dependencies
29+
run: pip install --upgrade babel jinja2
30+
- name: Extract translations from source code
31+
run: python utils/babel_runner.py extract
32+
- name: Push translations to transifex.com
33+
run: |
34+
cd sphinxcontrib/applehelp/locales
35+
/tmp/tx_cli/tx push --source --use-git-timestamps --workers 10
36+
env:
37+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
38+
39+
pull:
40+
permissions:
41+
contents: write # for peter-evans/create-pull-request to create branch
42+
pull-requests: write # for peter-evans/create-pull-request to create a PR
43+
if: github.repository_owner == 'sphinx-doc'
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- uses: actions/checkout@v3
48+
- name: Set up Python
49+
uses: actions/setup-python@v4
50+
with:
51+
python-version: 3
52+
- name: Install transifex client
53+
run: |
54+
mkdir -p /tmp/tx_cli && cd $_
55+
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
56+
shell: bash
57+
- name: Install dependencies
58+
run: pip install --upgrade babel jinja2
59+
- name: Extract translations from source code
60+
run: python utils/babel_runner.py extract
61+
- name: Pull translations from transifex.com
62+
run: |
63+
cd sphinxcontrib/applehelp/locales
64+
/tmp/tx_cli/tx pull --translations --all --force --use-git-timestamps --workers 10
65+
env:
66+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
67+
- name: Compile message catalogs
68+
run: python utils/babel_runner.py compile
69+
- name: Create Pull Request
70+
uses: peter-evans/create-pull-request@v4
71+
with:
72+
commit-message: "[internationalisation] Update translations"
73+
branch: bot/pull-translations
74+
title: "[bot]: Update message catalogues"
75+
labels: "internals:internationalisation"

0 commit comments

Comments
 (0)