From 152c67cba0d296c5d9be461e9a80140cc9036fd3 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Sat, 1 Apr 2017 00:32:55 +0200 Subject: [PATCH] [enh] try to automatically generate a PR when en.json has been updated from tartare --- should_i_rebuild.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/should_i_rebuild.sh b/should_i_rebuild.sh index 70a2841b..da0ba83a 100644 --- a/should_i_rebuild.sh +++ b/should_i_rebuild.sh @@ -1,5 +1,11 @@ #!/bin/bash +install_hub() { + wget https://github.com/github/hub/releases/download/v2.3.0-pre9/hub-linux-amd64-2.3.0-pre9.tgz + tar xf hub-linux-amd64-2.3.0-pre9.tgz + hub-linux-amd64-2.3.0-pre9/bin/hub pull-request +} + set -ex if [ ! "$1" ] @@ -11,6 +17,7 @@ fi before_official=$(sha256sum official.json) before_community=$(sha256sum community.json) before_dev=$(sha256sum dev.json) +before_pull_commit=$(git show HEAD | head -n 1) git pull @@ -28,3 +35,26 @@ if [ "$before_dev" != "$(sha256sum dev.json)" ] then python ./list_builder.py -g $1 dev.json fi + +if [ "$before_pull_commit" != "$(git show HEAD | head -n 1)" ] +then + python ./update_translations.py + if [ "$(git status -s| grep 'M locales/en.json')" ] + then + git add locales/en.json + git commit -m "[mod] update en.json with new translations" + git push yunohost-bot master + + # uses hub/git-spindle from pypi + # to install: + # $ virtualenv ve + # $ ve/bin/pip install "hub==2.0" + + if [ ! -e hub-linux-amd64-2.3.0-pre9/bin/hub ] + then + install_hub + fi + + hub-linux-amd64-2.3.0-pre9/bin/hub pull-request -h master -m "Update locales/en.json" + fi +fi