Skip to content

Commit cb302b1

Browse files
testing
0 parents  commit cb302b1

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Pull Translations from Transifex
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
push:
7+
branches:
8+
- '*'
9+
workflow_dispatch:
10+
11+
jobs:
12+
update-translation:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
version: [ '3.14' ]
18+
steps:
19+
- uses: styfle/cancel-workflow-action@main
20+
with:
21+
access_token: ${{ secrets.GITHUB_TOKEN }}
22+
- uses: actions/setup-python@master
23+
with:
24+
python-version: 3
25+
- name: Install Dependencies
26+
run: |
27+
sudo apt-get install -y gettext
28+
pip install requests cogapp polib transifex-python sphinx-intl blurb six
29+
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
30+
working-directory: /usr/local/bin
31+
- uses: actions/checkout@master
32+
with:
33+
ref: ${{ matrix.version }}
34+
fetch-depth: 0
35+
- run: curl -O https://raw.githubusercontent.com/python-docs-translations/transifex-automation/master/sample-workflows/transifex-util.py
36+
- run: ./manage_translation.py recreate_tx_config --language de --project-slug python-newest --version 3.14
37+
env:
38+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
39+
- run: ./manage_translation.py fetch --language de --project-slug python-newest --version 3.13
40+
env:
41+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
42+
- run: ./manage_translation.py delete_obsolete_files --language de --project-slug python-newest --version 3.14
43+
- name: Set up Git
44+
run: |
45+
git config --local user.email [email protected]
46+
git config --local user.name "GitHub Action's update-translation job"
47+
- name: Filter files
48+
run: |
49+
! git diff -I'^"POT-Creation-Date: ' \
50+
-I'^"Language-Team: ' \
51+
-I'^# ' -I'^"Last-Translator: ' \
52+
--exit-code \
53+
&& echo "SIGNIFICANT_CHANGES=1" >> $GITHUB_ENV || exit 0
54+
- run: git add .
55+
- run: git commit -m 'Update translation from Transifex'
56+
if: env.SIGNIFICANT_CHANGES
57+
- uses: ad-m/github-push-action@master
58+
if: env.SIGNIFICANT_CHANGES
59+
with:
60+
branch: ${{ matrix.version }}
61+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)