CI: try to show who helped to translate ZNC

This commit is contained in:
Alexey Sokolov
2020-06-07 14:41:05 +01:00
parent dd7b44ee45
commit 0f413ea3eb
2 changed files with 32 additions and 0 deletions

View File

@@ -50,6 +50,13 @@ timestamps {
}
sh 'LANG=C.UTF-8 find . -name "*.po" -exec msgfilter -i "{}" -o "{}.replacement" .ci/cleanup-po.pl ";"'
sh 'find . -name "*.po" -exec mv "{}.replacement" "{}" ";"'
withCredentials([string(credentialsId: 'fe727e3e-a8e0-4019-817f-6583c3c51ef7', variable: 'CROWDIN_API2_KEY')]) {
def headers = [[maskValue: true, name: 'Authorization', value: "Bearer ${env.CROWDIN_API2_KEY}"], [maskValue: false, name: 'User-Agent', value: 'https://github.com/znc/znc/blob/master/.ci/Jenkinsfile.crowdin']]
def contributors = httpRequest consoleLogResponseBody: true, customHeaders: headers, url: "https://crowdin.com/api/v2/projects/289533/members?limit=500"
writeFile file: 'contributors.tmp', text: contributors.content
}
sh '.ci/crowdin-contributors.py < contributors.tmp'
sh 'rm contributors.tmp'
}
stage("Push ${upstream_branch}") {
sh 'git config user.name "ZNC-Jenkins"'

25
.ci/crowdin-contributors.py Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python
import json
import sys
array = []
data = json.load(sys.stdin)
for user in data['data']:
user = user['data']
if user['fullName']:
array.append('* {} ({})'.format(user['username'], user['fullName']))
else:
array.append('* ' + user['username'])
array.sort(key=lambda x: x.lower())
sys.stdout = open('TRANSLATORS.md', 'wt')
print('These people helped translating ZNC to various languages:')
print()
for u in array:
print(u)
print()
print('Generated from https://crowdin.com/project/znc-bouncer')