File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Expand file tree Collapse file tree 2 files changed +72
-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
+ schedule :
6
+ - cron : ' 4 4 * * 0'
7
+
8
+ env :
9
+ GIT_AUTHOR_NAME : Django Girls Automation
10
+ GIT_AUTHOR_EMAIL :
[email protected]
11
+
12
+ jobs :
13
+ list_languages :
14
+ name : List languages
15
+ runs-on : ubuntu-latest
16
+ if : github.repository_owner == 'djangogirls'
17
+ outputs :
18
+ languages : ${{ steps.set_list.outputs.languages }}
19
+ steps :
20
+ - name : Checkout
21
+ uses : actions/checkout@v2
22
+ - name : Set the language list
23
+ id : set_list
24
+ run : ./.github/list_languages
25
+
26
+ update_language :
27
+ name : ' Update ${{ matrix.language }} translations from Crowdin'
28
+ needs : list_languages
29
+ if : ${{ needs.list_languages.outputs.languages != '[]' }}
30
+ runs-on : ubuntu-latest
31
+ strategy :
32
+ fail-fast : false
33
+ matrix :
34
+ language : ${{ fromJson(needs.list_languages.outputs.languages) }}
35
+ steps :
36
+ - name : Checkout
37
+ uses : actions/checkout@v2
38
+ - name : Update language
39
+ run : |
40
+ wget https://crowdin.com/backend/download/project/django-girls-tutorial/${{ matrix.language }}.zip
41
+ unzip ${{ matrix.language }}.zip
42
+ find ${{ matrix.language }} -name '*.md' -delete
43
+ rsync -av master/${{ matrix.language }}*/* ${{ matrix.language }}/
44
+ rm -rf ${{ matrix.language }}.zip master
45
+ - name : Open a PR
46
+ uses : peter-evans/create-pull-request@v3
47
+ with :
48
+ commit-message : " Update ${{ matrix.language }} translations from Crowdin"
49
+ branch : " update_translations/${{ matrix.language }}"
50
+ title : " Update ${{ matrix.language }} translations from Crowdin"
51
+ body : ' '
52
+ delete-branch : true
You can’t perform that action at this time.
0 commit comments