name: Pull Translations from Transifex
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update-translation:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [ '3.15', '3.14', '3.13', '3.12', '3.11' ]
steps:
- uses: styfle/cancel-workflow-action@main
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@master
with:
python-version: '3.12'
- name: Install Dependencies
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y gettext curl tar
python -m pip install --upgrade pip
pip install requests cogapp polib transifex-python sphinx-intl blurb six
# Install tx deterministically with retries instead of piping installer script.
TX_URL="https://github.com/transifex/cli/releases/latest/download/tx-linux-amd64.tar.gz"
curl -fL --retry 5 --retry-delay 2 --retry-connrefused "$TX_URL" -o /tmp/tx.tar.gz
tar -xzf /tmp/tx.tar.gz -C /tmp
sudo install -m 0755 /tmp/tx /usr/local/bin/tx
command -v tx
tx --version
- uses: actions/checkout@master
with:
ref: ${{ matrix.version }}
fetch-depth: 0
- run: curl -fL -o transifex-util.py https://raw.githubusercontent.com/python-docs-translations/transifex-automations/master/sample-workflows/transifex-util.py
- run: chmod +x transifex-util.py
- name: Patch helper for cross-version Doc Makefile compatibility
run: |
python - $GITHUB_ENV || exit 0
- run: git commit -m 'Update translation from Transifex'
if: env.SIGNIFICANT_CHANGES == '1'
- uses: ad-m/github-push-action@master
if: env.SIGNIFICANT_CHANGES == '1'
with:
branch: ${{ matrix.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}