From d4e4313caa4e1620561f4f1b4dfd407722915f34 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Tue, 12 Aug 2025 08:33:08 +0200 Subject: [PATCH 1/2] Start workflow --- .github/workflows/transifex-pull.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/transifex-pull.yml b/.github/workflows/transifex-pull.yml index f897471..2946c52 100644 --- a/.github/workflows/transifex-pull.yml +++ b/.github/workflows/transifex-pull.yml @@ -53,4 +53,9 @@ jobs: && echo "SIGNIFICANT_CHANGES=1" >> $GITHUB_ENV || exit 0 - run: git add . - run: git commit -m 'Update translation from Transifex' - if: env.SIGNIFICANT_CHANGES \ No newline at end of file + if: env.SIGNIFICANT_CHANGES + - uses: ad-m/github-push-action@master + if: env.SIGNIFICANT_CHANGES + with: + branch: ${{ matrix.version }} + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From f9bf6a3c6a7a66c290ffab2ee54b1d65c7f0428c Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 13 Sep 2025 16:56:49 +0100 Subject: [PATCH 2/2] Refactor. --- .github/workflows/transifex-pull.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/transifex-pull.yml b/.github/workflows/transifex-pull.yml index 2946c52..34187a6 100644 --- a/.github/workflows/transifex-pull.yml +++ b/.github/workflows/transifex-pull.yml @@ -1,5 +1,4 @@ name: Pull Translations from Transifex - on: schedule: - cron: '0 0 * * *' @@ -14,13 +13,16 @@ jobs: fail-fast: false matrix: version: [ '3.14' ] + steps: - uses: styfle/cancel-workflow-action@main with: access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-python@master with: python-version: 3 + - name: Install Dependencies run: | sudo apt-get install -y gettext @@ -29,21 +31,27 @@ jobs: curl -O https://raw.githubusercontent.com/python-docs-translations/transifex-automations/master/sample-workflows/transifex-util.py chmod +x transifex-util.py working-directory: /usr/local/bin + - uses: actions/checkout@master with: ref: ${{ matrix.version }} fetch-depth: 0 + - run: transifex-util.py recreate_tx_config --language hu --project-slug python-newest --version ${{ matrix.version }} env: TX_TOKEN: ${{ secrets.TX_TOKEN }} + - run: transifex-util.py fetch --language hu --project-slug python-newest --version ${{ matrix.version }} env: TX_TOKEN: ${{ secrets.TX_TOKEN }} + - run: transifex-util.py delete_obsolete_files --language hu --project-slug python-newest --version ${{ matrix.version }} + - name: Set up Git run: | git config --local user.email github-actions@github.com git config --local user.name "GitHub Action's update-translation job" + - name: Filter files run: | ! git diff -I'^"POT-Creation-Date: ' \ @@ -51,9 +59,12 @@ jobs: -I'^# ' -I'^"Last-Translator: ' \ --exit-code \ && echo "SIGNIFICANT_CHANGES=1" >> $GITHUB_ENV || exit 0 + - run: git add . + - run: git commit -m 'Update translation from Transifex' if: env.SIGNIFICANT_CHANGES + - uses: ad-m/github-push-action@master if: env.SIGNIFICANT_CHANGES with: