Skip to content

Commit e21ec39

Browse files
authored
Merge pull request #3 from steppi/auto-translation-pr
Auto translation pr
2 parents 373adb3 + 94b28b9 commit e21ec39

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Create Translations PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
language_code:
7+
description: 'Crowdin language code for the language of interest'
8+
required: true
9+
10+
jobs:
11+
auto-translation-pr:
12+
runs-on: ubuntu-latest
13+
# Run only on main branch in upstream repo.
14+
if: ${{ github.repository == 'steppi/numpy.org' && github.ref == 'refs/heads/auto-translation-pr' }}
15+
steps:
16+
- name: Checkout numpy.org
17+
uses: actions/checkout@v4
18+
with:
19+
repository: 'numpy/numpy.org'
20+
path: 'numpy.org'
21+
ref: 'main'
22+
23+
- name: Checkout scientific-python-translations automations
24+
uses: actions/checkout@v4
25+
with:
26+
repository: 'steppi/automations'
27+
path: 'automations'
28+
ref: 'filter_commits'
29+
30+
- name: Create translations branch for language of interest
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
cd numpy.org
35+
branch_name=$(../automations/scripts/create_branch_for_language.sh numpy main l10n_main ${{ github.event.inputs.language_code }})
36+
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
37+
working-directory: ./numpy.org
38+
39+
- name: Create Pull Request
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
language_name=$(../automations/scripts/get_language_name.sh ${{ github.event.inputs.language_code }})
44+
gh pr create --base main --head ${{ env.BRANCH_NAME }} --title "Update translations for $language_name" \
45+
--body "This PR to update translations for $language_name was generated by the GitHub workflow, \
46+
`auto-translations-pr.yml` and includes all commits from this repo's Crowdin branch for the language \
47+
of interest. A final check of the rendered docs is needed to identify if there are any formatting \
48+
errors due to incorrect string segmentation by Crowdin. If there are such formatting errors, they \
49+
should be fixed directly on this branch, not through Crowdin.")
50+
working-directory: ./numpy.org

0 commit comments

Comments
 (0)