Skip to content

Instantly share code, notes, and snippets.

@tonyc
Last active May 23, 2019 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonyc/8669e3ed522e1f59122c1f241a8d0851 to your computer and use it in GitHub Desktop.
Save tonyc/8669e3ed522e1f59122c1f241a8d0851 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
get_latest_sha () {
heroku releases --num 1 --remote $1 2> /dev/null | grep -v === | awk '{print $3}'
}
STAGING_SHA=$(get_latest_sha "staging")
PRODUCTION_SHA=$(get_latest_sha "production")
echo "Staging: $STAGING_SHA, Production: $PRODUCTION_SHA"
if [[ $STAGING_SHA == $PRODUCTION_SHA ]]; then
echo "Production is caught up to staging"
else
echo "Production is behind staging"
git log --no-decorate --date=short --pretty=format:"%Cred%h%Creset %Cgreen%ad%Creset %s" $PRODUCTION_SHA..$STAGING_SHA
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment