Skip to content

Commit

Permalink
Add a workflow to synchronisation translations
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Aug 7, 2023
1 parent c93ef3a commit 5d40cb8
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/transifex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Synchronise translations

on:
schedule:
# 22:38 GMT, every Sunday. Chosen to be a random time.
- cron: "38 22 * * SUN"
workflow_dispatch:

permissions:
contents: read

jobs:
push:
if: github.repository_owner == 'sphinx-doc'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install transifex client
run: |
mkdir -p /tmp/tx_cli && cd $_
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
shell: bash
- name: Install dependencies
run: pip install --upgrade babel jinja2
- name: Extract translations from source code
run: python utils/babel_runner.py extract
- name: Push translations to transifex.com
run: |
cd sphinxcontrib/htmlhelp/locales
/tmp/tx_cli/tx push --source --use-git-timestamps --workers 10
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}

pull:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
if: github.repository_owner == 'sphinx-doc'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install transifex client
run: |
mkdir -p /tmp/tx_cli && cd $_
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
shell: bash
- name: Install dependencies
run: pip install --upgrade babel jinja2
- name: Extract translations from source code
run: python utils/babel_runner.py extract
- name: Pull translations from transifex.com
run: |
cd sphinxcontrib/htmlhelp/locales
/tmp/tx_cli/tx pull --translations --all --force --use-git-timestamps --workers 10
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
- name: Compile message catalogs
run: python utils/babel_runner.py compile
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "[internationalisation] Update translations"
branch: bot/pull-translations
title: "[bot]: Update message catalogues"
labels: "internals:internationalisation"

0 comments on commit 5d40cb8

Please sign in to comment.