Skip to content

Commit 161bcb6

Browse files
authored
Split commit job (#298)
1 parent 1413177 commit 161bcb6

2 files changed

Lines changed: 52 additions & 9 deletions

File tree

.github/workflows/sync.yml

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,21 @@ env:
2020
PYDOC_LANGUAGE: pt_BR
2121
PYDOC_TX_PROJECT: ${{ inputs.tx_project }}
2222
PYDOC_VERSION: ${{ inputs.version }}
23+
PYDOC_LANG_DIR: ${{ inputs.version }}
2324
TX_CLI_VERSION: '1.6.17'
2425

2526
jobs:
2627
sync:
2728
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
2831
steps:
2932

3033
# 1- Set up environment
3134

3235
- name: Check out this repository
3336
uses: actions/checkout@v6
3437

35-
- name: Set language dir variable
36-
run:
37-
echo "PYDOC_LANG_DIR=${{ env.PYDOC_VERSION }}" >> $GITHUB_ENV
38-
3938
- name: Checkout this repository ${{ env.PYDOC_VERSION }}
4039
uses: actions/checkout@v6
4140
with:
@@ -107,7 +106,53 @@ jobs:
107106
env:
108107
PYDOC_LANG_DIR: ${{ env.PYDOC_LANG_DIR }}
109108

110-
# 4- Commit and push translations
109+
- name: Upload translation artifacts
110+
uses: actions/upload-artifact@v7
111+
with:
112+
name: python-${{ env.PYDOC_VERSION }}
113+
path: |
114+
.tx/config
115+
potodo.md
116+
stats.json
117+
*.po
118+
**/*.po
119+
120+
commit:
121+
runs-on: ubuntu-latest
122+
needs: sync
123+
permissions:
124+
contents: write
125+
steps:
126+
127+
# 1- Set up environment
128+
129+
- name: Check out this repository
130+
uses: actions/checkout@v6
131+
132+
- name: Checkout this repository ${{ env.PYDOC_VERSION }}
133+
uses: actions/checkout@v6
134+
with:
135+
ref: ${{ env.PYDOC_VERSION }}
136+
path: ${{ env.PYDOC_LANG_DIR }}
137+
138+
- uses: actions/setup-python@v6
139+
with:
140+
python-version: ${{ inputs.version }}
141+
allow-prereleases: true
142+
cache: 'pip'
143+
pip-install: -r requirements.txt
144+
145+
# 2- Remove PO files and the download files (excluding obsolete)
146+
147+
- name: Clean PO files
148+
run: find ${{ env.PYDOC_LANG_DIR }} -name '*.po' | xargs -r rm
149+
150+
- name: Download translation artifacts
151+
uses: actions/download-artifact@v8
152+
with:
153+
name: python-${{ env.PYDOC_VERSION }}
154+
155+
# 3- Commit and push changed files depending on the event name
111156

112157
- name: Commit
113158
run: ./scripts/commit.sh
@@ -119,5 +164,3 @@ jobs:
119164
run: |
120165
cd ./${{ env.PYDOC_LANG_DIR }}
121166
git push
122-
123-

scripts/commit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ extra_files=".tx/config stats.json potodo.md"
1616

1717
set +u
1818
if [ -n "${CI+x}" ]; then
19-
git config user.email "github-actions[bot]@users.noreply.github.com"
20-
git config user.name "github-actions[bot]"
19+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
20+
git config user.name "github-actions"
2121
fi
2222
set -u
2323

0 commit comments

Comments
 (0)