Skip to content

Commit 262511b

Browse files
authored
Make translation files dir reusable in sync.yml
1 parent 206f776 commit 262511b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/sync.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ env:
2121
PYDOC_TX_PROJECT: ${{ inputs.tx_project }}
2222
PYDOC_VERSION: ${{ inputs.version }}
2323
TX_CLI_VERSION: '1.6.16'
24+
LANGUAGE_DIR: cpython/Doc/locales/${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES
25+
2426

2527
jobs:
2628
sync:
@@ -43,7 +45,7 @@ jobs:
4345
uses: actions/checkout@v4
4446
with:
4547
ref: ${{ env.PYDOC_VERSION }}
46-
path: cpython/Doc/locales/${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES
48+
path: ${{ env.LANGUAGE_DIR }}
4749

4850
- uses: actions/setup-python@v5
4951
with:
@@ -79,30 +81,30 @@ jobs:
7981
if: ${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
8082
run: |
8183
# Clean up obsolete files
82-
find cpython/Doc/locales/$PYDOC_LANGUAGE/LC_MESSAGES -name '*.po' -exec rm {} \;
84+
find ./${LANGUAGE_DIR} -name '*.po' -exec rm {} \;
8385
./scripts/pull_translations.sh
8486
env:
8587
TX_TOKEN: ${{ secrets.TX_TOKEN }}
8688

8789
- name: powrap
8890
if: steps.pull.outcome == 'success'
8991
run: |
90-
cd cpython/Doc/locales/${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES
92+
cd ./${LANGUAGE_DIR}
9193
powrap *.po **/*.po
9294
9395
- name: Update statistics
9496
if: always() && inputs.secrets.TX_TOKEN != 0
9597
run: |
96-
python ./scripts/tx_stats.py > cpython/Doc/locales/${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES/stats.json
97-
git -C cpython/Doc/locales/${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES/ diff stats.json
98+
python ./scripts/tx_stats.py > ./${LANGUAGE_DIR}/stats.json
99+
git -C ./${LANGUAGE_DIR} diff stats.json
98100
env:
99101
TX_TOKEN: ${{ secrets.TX_TOKEN }}
100102

101103
- name: Update potodo.md
102104
if: always()
103105
run: |
104106
./scripts/potodo.sh
105-
git diff cpython/Doc/locales/${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES/potodo.md
107+
git diff ./${LANGUAGE_DIR}/potodo.md
106108
107109
# 4- Commit and push translations
108110

@@ -112,7 +114,7 @@ jobs:
112114
- name: Push
113115
if: ${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
114116
run: |
115-
cd cpython/Doc/locales/${{ env.PYDOC_LANGUAGE}}/LC_MESSAGES
117+
cd ./${LANGUAGE_DIR}
116118
git push
117119
118120

0 commit comments

Comments
 (0)