Skip to content

Commit 3bc5109

Browse files
committed
ci: modernize GitHub Actions workflows
1 parent 89979e3 commit 3bc5109

2 files changed

Lines changed: 34 additions & 10 deletions

File tree

‎.github/workflows/transifex-pull.yml‎

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,74 @@ on:
44
schedule:
55
- cron: '0 0 * * *'
66
workflow_dispatch:
7+
78
permissions:
89
contents: write
910

1011
jobs:
1112
update-translation:
1213
runs-on: ubuntu-latest
14+
1315
strategy:
1416
fail-fast: false
1517
matrix:
16-
version: [ '3.15' ]
18+
version: ['3.15']
19+
1720
steps:
1821
- uses: styfle/cancel-workflow-action@main
1922
with:
2023
access_token: ${{ secrets.GITHUB_TOKEN }}
21-
- uses: actions/setup-python@master
24+
25+
- uses: actions/setup-python@v5
2226
with:
23-
python-version: 3
27+
python-version: "3.x"
28+
2429
- name: Install Dependencies
2530
run: |
31+
sudo apt-get update
2632
sudo apt-get install -y gettext
2733
pip install requests cogapp polib transifex-python sphinx-intl blurb six
2834
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
2935
working-directory: /usr/local/bin
30-
- uses: actions/checkout@master
36+
37+
- uses: actions/checkout@v4
3138
with:
3239
ref: ${{ matrix.version }}
3340
fetch-depth: 0
41+
3442
- run: curl -O https://raw.githubusercontent.com/python-docs-translations/transifex-automations/master/sample-workflows/transifex-util.py
43+
3544
- run: chmod +x transifex-util.py
45+
3646
- run: ./transifex-util.py recreate_tx_config --language pa --project-slug python-newest --version ${{ matrix.version }}
3747
env:
3848
TX_TOKEN: ${{ secrets.TX_TOKEN }}
49+
3950
- run: ./transifex-util.py fetch --language pa --project-slug python-newest --version ${{ matrix.version }}
4051
env:
4152
TX_TOKEN: ${{ secrets.TX_TOKEN }}
53+
4254
- run: ./transifex-util.py delete_obsolete_files --language pa --project-slug python-newest --version ${{ matrix.version }}
43-
- name: Set up Git
55+
56+
- name: Configure Git
4457
run: |
45-
git config --local user.email github-actions@github.com
46-
git config --local user.name "GitHub Action's update-translation job"
58+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
59+
git config --local user.name "github-actions[bot]"
60+
4761
- name: Filter files
4862
run: |
4963
! git diff -I'^"POT-Creation-Date: ' \
5064
-I'^"Language-Team: ' \
51-
-I'^# ' -I'^"Last-Translator: ' \
65+
-I'^# ' \
66+
-I'^"Last-Translator: ' \
5267
--exit-code \
5368
&& echo "SIGNIFICANT_CHANGES=1" >> $GITHUB_ENV || exit 0
69+
5470
- run: git add . ':!transifex-util.py'
55-
- run: git commit -m 'Update translation from Transifex'
71+
72+
- run: git commit -m "Update translation from Transifex"
5673
if: env.SIGNIFICANT_CHANGES
74+
5775
- uses: ad-m/github-push-action@master
5876
if: env.SIGNIFICANT_CHANGES
5977
with:

‎.github/workflows/validate.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ on:
44
push:
55
pull_request:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
validate:
12+
name: Validate Translation Files
913
runs-on: ubuntu-latest
1014

1115
steps:
@@ -19,4 +23,6 @@ jobs:
1923
2024
- name: Validate PO files
2125
run: |
22-
find . -name "*.po" -exec msgfmt --check {} \;
26+
find . -type f -name "*.po" -print0 | while IFS= read -r -d '' file; do
27+
msgfmt --check "$file"
28+
done

0 commit comments

Comments
 (0)