post-merge 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. red="$(tput setaf 1)"
  3. bold="$(tput bold)"
  4. reset="$(tput sgr0)"
  5. files_changed_upstream="$(mktemp)"
  6. trap "rm -f ${files_changed_upstream}" EXIT
  7. git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD > "$files_changed_upstream"
  8. grep -E --quiet 'requirements-pre-commit\.txt' "$files_changed_upstream" && pc="setup-git "
  9. grep -E --quiet 'requirements-(base|dev)\.txt' "$files_changed_upstream" && py="install-py-dev "
  10. grep -E --quiet 'yarn\.lock' "$files_changed_upstream" && js="install-js-dev "
  11. grep -E --quiet 'migrations' "$files_changed_upstream" && migrations="apply-migrations "
  12. [[ "$pc" || "$py" || "$js" || "$migrations" ]] && needs_update=1
  13. update_command="make ${pc}${py}${js}${migrations}"
  14. [[ "$needs_update" ]] && cat <<EOF
  15. [${red}${bold}!!!${reset}] ${red} It looks like some dependencies have changed that will require your intervention. Run the following to update:${reset}
  16. ${red}${bold}${update_command}${reset}
  17. EOF
  18. if [[ "$SENTRY_POST_MERGE_AUTO_UPDATE" && "$needs_update" ]]; then
  19. $update_command
  20. fi