Skip to content

Commit

Permalink
Allow deploy to production from non-main branch
Browse files Browse the repository at this point in the history
Show a prompt as a safeguard
  • Loading branch information
hirasso committed Mar 28, 2024
1 parent a63abfc commit a56ceb7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ function validateProductionBranch() {

# Validate the branch
if [[ "${REMOTE_ENV}" == "production" && ! $CURRENT_BRANCH =~ $PRODUCTION_BRANCH ]]; then
logError "Branch ${BLUE}${CURRENT_BRANCH}${NC} not allowed in ${BLUE}production${NC}"
log "🚨 You are on the branch ${RED}${CURRENT_BRANCH}${NC}. Proceed deploy to ${BOLD}production${NORMAL}?"
read -r -p "[y/n] " PROMPT_RESPONSE

# Exit early if not confirmed
if [[ "$PROMPT_RESPONSE" != "y" ]]; then
log "❌ Deploy to $PRETTY_REMOTE_ENV canceled"
exit
fi
else
logSuccess "Branch ${BLUE}${CURRENT_BRANCH}${NC} allowed in ${BLUE}${REMOTE_ENV}${NC}"
fi
Expand Down

0 comments on commit a56ceb7

Please sign in to comment.