32 lines
905 B
Bash
Executable File
32 lines
905 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
COMMANDS=${1:-}
|
|
REPLACED_MESSAGE=${REPLACED_MESSAGE:-}
|
|
|
|
# Note that when running locally this will check for untracked files.
|
|
if [ -z "$(git status --porcelain)" ]; then
|
|
echo "OK, working tree is clean."
|
|
exit 0
|
|
fi
|
|
|
|
echo -e "\e[0Ksection_start:$(date +%s):git_status[collapsed=true]\r\e[0Kgit status"
|
|
git status
|
|
echo -e "\e[0Ksection_end:$(date +%s):git_status\r\e[0K"
|
|
|
|
echo -e "\e[0Ksection_start:$(date +%s):git_diff[collapsed=true]\r\e[0Kgit diff"
|
|
git diff
|
|
echo -e "\e[0Ksection_end:$(date +%s):git_diff\r\e[0K"
|
|
|
|
echo
|
|
if [ -n "$REPLACED_MESSAGE" ]; then
|
|
echo "❗$REPLACED_MESSAGE"
|
|
elif [ -n "$COMMANDS" ]; then
|
|
echo "❗Please run '$COMMANDS' locally and commit the changes."
|
|
else
|
|
echo "❗There are uncommitted changes. Check git diff/status above. Try running 'make devp/format-go devp/go-mod-tidy' locally and make sure everything is generated."
|
|
fi
|
|
|
|
exit 1
|