#!/usr/bin/env bash
set -e

BRANCH="main"

if [ -z "$(git status --porcelain)" ]; then
  echo "No changes to commit."
  exit 0
fi

MSG="update-$(date +%Y%m%d-%H%M%S)-$RANDOM"
echo "Using commit message: $MSG"

echo "==> git add"
git add .

echo "==> git commit"
git commit -m "$MSG"

echo "==> git push"
git push origin "$BRANCH"

echo "Done."