Skip to content

Commit 43df930

Browse files
committed
Ensure everything is committed before deploying
1 parent 6cd780e commit 43df930

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bin/deploy

+16
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ echo "Deploying..."
4646
echo "Source branch: $SRC_BRANCH"
4747
echo "Deploy branch: $DEPLOY_BRANCH"
4848

49+
read -r -p "Do you want to proceed? [y/N] " response
50+
if [[ ! $response =~ ^([yY][eE][sS]|[yY])+$ ]]
51+
then
52+
echo "Aborting."
53+
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
54+
fi
55+
56+
# Check if there are any uncommitted changes
57+
if ! git diff-index --quiet HEAD --; then
58+
echo "Changes to the following files are uncommitted:"
59+
git diff-index --name-only HEAD --
60+
echo "Please commit the changes before proceeding."
61+
echo "Aborting."
62+
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
63+
fi
64+
4965
# Switch to source branch (creates it if necessary from the current branch)
5066
if [ `git branch | grep $SRC_BRANCH | tr ' ' '\n' | tail -1` ]
5167
then

0 commit comments

Comments
 (0)