Files
probot.github.io/script/remote-sync
2017-09-09 11:38:18 -05:00

23 lines
490 B
Bash
Executable File

#!/usr/bin/env bash
# Run script/sync-data and push changes.
set -x # print commands before execution
set -o errexit # always exit on error
set -o pipefail # honor exit codes when piping
echo "===> Syncing data"
script/sync-data
git diff --quiet || {
echo "===> Committing and pushing changes"
git commit -am "Sync data"
REPO=`git config remote.origin.url`
if [[ -n "$GH_TOKEN" ]]; then
REPO=${REPO/https:\/\//https://${GH_TOKEN}@}
fi
git push $REPO
}