From fcb7d39a179db4c73842ca9740bdefe82dad3401 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Tue, 21 Nov 2017 22:03:50 +0000 Subject: [PATCH] Crowdin: change text of pull request --- .ci/Jenkinsfile.crowdin | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile.crowdin b/.ci/Jenkinsfile.crowdin index 6fe32ad3..88216de1 100644 --- a/.ci/Jenkinsfile.crowdin +++ b/.ci/Jenkinsfile.crowdin @@ -1,4 +1,9 @@ #!groovy +// This script is run daily by https://jenkins.znc.in/ to: +// * upload new English strings to https://crowdin.com/project/znc-bouncer +// * download new translations +// * create a pull request with results to ZNC repo + import groovy.json.JsonSlurper; // TODO refactor this after ZNC 1.7 is released, because we'll need many branches @@ -39,7 +44,12 @@ timestamps { sh 'git config user.email jenkins@znc.in' sh 'git status' sh 'git add .' - sh 'git commit -m "Update translations from Crowdin"' + try { + sh 'git commit -m "Update translations from Crowdin"' + } catch(e) { + echo 'No changes found' + return + } sh "git remote add my github.com:${my_user}/${my_repo}.git" // TODO simplify when https://issues.jenkins-ci.org/browse/JENKINS-28335 is fixed withCredentials([sshUserPrivateKey(credentialsId: '6ef10f80-20dc-4661-af45-52a6e1e15749', keyFileVariable: 'GITHUB_KEY')]) { @@ -55,7 +65,7 @@ timestamps { def pulls = httpRequest consoleLogResponseBody: true, customHeaders: headers, url: "https://api.github.com/repos/${upstream_user}/${upstream_repo}/pulls", requestBody: '{"head":"'+my_user+':'+my_branch+'","base":"'+upstream_branch+'"}' pulls = new JsonSlurper().parseText(pulls.content) if (!pulls) { - httpRequest consoleLogResponseBody: true, customHeaders: headers, url: "https://api.github.com/repos/${upstream_user}/${upstream_repo}/pulls", httpMode: 'POST', requestBody: '{"head":"'+my_user+':'+my_branch+'","base":"'+upstream_branch+'","title":"Update translations from Crowdin"}' + httpRequest consoleLogResponseBody: true, customHeaders: headers, url: "https://api.github.com/repos/${upstream_user}/${upstream_repo}/pulls", httpMode: 'POST', requestBody: '{"head":"'+my_user+':'+my_branch+'","base":"'+upstream_branch+'","title":"Update translations","body":"From https://crowdin.com/project/znc-bouncer"}' } } }