Files
probot.github.io/script/remote-sync
2017-09-09 12:13:44 -05:00

22 lines
434 B
Bash
Executable File

#!/usr/bin/env bash
# Run script/sync-data and push changes.
set -e
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 GH_TOKEN environment variable is present, use that to push.
if [[ -n "$GH_TOKEN" ]]; then
REPO=${REPO/https:\/\//https://${GH_TOKEN}@}
fi
git push $REPO HEAD:master
}