Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions updater/cmd.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[ -z "${REPO_POKEAPI}" ] && { echo "Need to set REPO_POKEAPI"; exit 1; }
[ -z "${REPO_DATA}" ] && { echo "Need to set REPO_DATA"; exit 1; }
[ -z "${BRANCH_NAME}" ] && { echo "Need to set BRANCH_NAME"; exit 1; }
[ -z "${REPO_POKEAPI_CHECKOUT_OBJECT:=master}" ] && { echo "REPO_POKEAPI_CHECKOUT_OBJECT not set, defaulting to \`master\`"; }

set -e
set -o pipefail
Expand All @@ -15,11 +16,14 @@ export COMPOSE_INTERACTIVE_NO_CLI=1

dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 &> /dev/null &

git clone --recurse-submodules "$REPO_POKEAPI" pokeapi
git clone "$REPO_POKEAPI" pokeapi
git clone --depth=1 "$REPO_DATA" api-data

# set up the pokeapi side
cd pokeapi
git checkout "$REPO_POKEAPI_CHECKOUT_OBJECT"
git submodule init
git submodule update --remote

docker volume create --name=redis_data
docker volume create --name=pg_data
Expand All @@ -45,5 +49,8 @@ ditto analyze --data-dir ./data
git add data
git config user.name "$COMMIT_NAME"
git config user.email "$COMMIT_EMAIL"
git commit -m "$COMMIT_MESSAGE"
if ! git commit -m "$COMMIT_MESSAGE"; then
echo "The generated data doesn't bring any updates"
exit 2
fi
git push -fu origin "$BRANCH_NAME"