push.sh: nicely exit if nothing to push

This commit is contained in:
Julien Bisconti
2018-07-20 20:10:58 +02:00
parent 4dbd42903b
commit e51c514419
4 changed files with 10 additions and 35453 deletions

14
push.sh
View File

@@ -10,13 +10,17 @@ git config --global user.name "veggiemonk-bot"
# let git know where to apply the changes
git checkout master
echo 'Adding data files'
echo "Adding data files"
git add data/*
echo 'Commiting files'
git commit -m 'Automated update repository metadata [skip ci]'
echo "Checking the number of files staged"
files=$(git diff --cached --numstat | wc -l | tr -d '[:space:]');
[[ $files -eq 0 ]] && echo "nothing to push, exiting..." && exit
echo 'Pushing changes'
echo "Commiting files"
git commit -m "Automated update repository metadata [skip ci]"
echo "Pushing changes"
git push https://$GITHUB_USER:$GITHUB_TOKEN@github.com/veggiemonk/awesome-docker master >/dev/null 2>&1
echo 'Done.'
echo "Done."