Skip to content

Pull Translations from Transifex #157

Pull Translations from Transifex

Pull Translations from Transifex #157

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.13', '3.14', '3.15']
steps:
- uses: styfle/cancel-workflow-action@main
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext
pip install requests cogapp polib transifex-python sphinx-intl blurb six
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
working-directory: /usr/local/bin
- uses: actions/checkout@v4
with:
ref: ${{ matrix.version }}
fetch-depth: 0
- run: curl -O https://raw.githubusercontent.com/python-docs-translations/transifex-automations/master/sample-workflows/transifex-util.py
- run: chmod +x transifex-util.py
- run: ./transifex-util.py recreate_tx_config --language pa --project-slug python-newest --version ${{ matrix.version }}
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
- name: Fetch reviewed translations from Transifex
run: |
./transifex-util.py fetch \
--language pa \
--project-slug python-newest \
--version ${{ matrix.version }} \
--pull-options="--mode reviewed"
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
- run: ./transifex-util.py delete_obsolete_files --language pa --project-slug python-newest --version ${{ matrix.version }}
- name: Configure Git
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Filter files
run: |
! git diff -I'^"POT-Creation-Date: ' \
-I'^"Language-Team: ' \
-I'^# ' \
-I'^"Last-Translator: ' \
--exit-code \
&& echo "SIGNIFICANT_CHANGES=1" >> $GITHUB_ENV || exit 0
- run: git add . ':!transifex-util.py'
- run: git commit -m "Update reviewed translations from Transifex"
if: env.SIGNIFICANT_CHANGES
- uses: ad-m/github-push-action@master
if: env.SIGNIFICANT_CHANGES
with:
branch: ${{ matrix.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}