-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
post-merge
executable file
·30 lines (20 loc) · 1.07 KB
/
post-merge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
red="$(tput setaf 1)"
bold="$(tput bold)"
reset="$(tput sgr0)"
files_changed_upstream="$(mktemp)"
trap "rm -f ${files_changed_upstream}" EXIT
git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD > "$files_changed_upstream"
grep -E --quiet 'requirements-pre-commit\.txt' "$files_changed_upstream" && pc="setup-git "
grep -E --quiet 'requirements-(base|dev)\.txt' "$files_changed_upstream" && py="install-py-dev "
grep -E --quiet 'yarn\.lock' "$files_changed_upstream" && js="install-js-dev "
grep -E --quiet 'migrations' "$files_changed_upstream" && migrations="apply-migrations "
[[ "$pc" || "$py" || "$js" || "$migrations" ]] && needs_update=1
update_command="make ${pc}${py}${js}${migrations}"
[[ "$needs_update" ]] && cat <<EOF
[${red}${bold}!!!${reset}] ${red} It looks like some dependencies have changed that will require your intervention. Run the following to update:${reset}
${red}${bold}${update_command}${reset}
EOF
if [[ "$SENTRY_POST_MERGE_AUTO_UPDATE" && "$needs_update" ]]; then
$update_command
fi