File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ import json
4+ import os
5+ from pathlib import Path
6+
7+
8+ def main ():
9+ directory = Path (__file__ ).absolute ().parent .parent
10+ languages = sorted (x .name for x in directory .iterdir ()
11+ if x .is_dir () and len (x .name ) == 2 and x .name != 'en' )
12+
13+ if 'GITHUB_ACTION' in os .environ :
14+ print (f'::set-output name=languages::{ json .dumps (languages )} ' )
15+ for language in languages :
16+ print (language )
17+
18+
19+ if __name__ == '__main__' :
20+ main ()
Original file line number Diff line number Diff line change 1+ name : Update translations
2+
3+ on :
4+ workflow_dispatch :
5+
6+ env :
7+ GIT_AUTHOR_NAME : Django Girls Automation
8+ GIT_AUTHOR_EMAIL :
[email protected] 9+
10+ jobs :
11+ list_languages :
12+ name : List languages
13+ runs-on : ubuntu-latest
14+ if : github.repository_owner == 'djangogirls'
15+ outputs :
16+ languages : ${{ steps.set_list.outputs.languages }}
17+ steps :
18+ - name : Checkout
19+ uses : actions/checkout@v2
20+ - name : Set the language list
21+ id : set_list
22+ run : ./.github/list_languages
23+
24+ update_language :
25+ name : ' Update ${{ matrix.language }} translations from Crowdin'
26+ needs : list_languages
27+ if : ${{ needs.list_languages.outputs.languages != '[]' }}
28+ runs-on : ubuntu-latest
29+ strategy :
30+ fail-fast : false
31+ matrix :
32+ language : ${{ fromJson(needs.list_languages.outputs.languages) }}
33+ steps :
34+ - name : Checkout
35+ uses : actions/checkout@v2
36+ - name : Update language
37+ run : |
38+ wget https://crowdin.com/backend/download/project/django-girls-tutorial/${{ matrix.language }}.zip
39+ unzip ${{ matrix.language }}.zip
40+ find ${{ matrix.language }} -name '*.md' -delete
41+ rsync -av master/${{ matrix.language }}*/* ${{ matrix.language }}/
42+ rm -rf ${{ matrix.language }}.zip master
43+ - name : Open a PR
44+ uses : peter-evans/create-pull-request@v3
45+ with :
46+ commit-message : " Update ${{ matrix.language }} translations from Crowdin"
47+ branch : " update_translations/${{ matrix.language }}"
48+ title : " Update ${{ matrix.language }} translations from Crowdin"
49+ body : ' '
50+ delete-branch : true
You can’t perform that action at this time.
0 commit comments