-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-push-script
More file actions
63 lines (51 loc) · 3.81 KB
/
Copy pathpre-push-script
File metadata and controls
63 lines (51 loc) · 3.81 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# --- Git pre-push hook with human confirmation ---
# Get the current branch name
branch=$(git rev-parse --abbrev-ref HEAD)
echo "📌 Selected Feature branch: $branch"
# Ask user if they want to run the command
read -p "Do you want to run make_my_docs_bot before pushing? (y/N): " confirm </dev/tty
confirm=$(echo "$confirm" | tr '[:upper:]' '[:lower:]') # macOS-safe lowercase
echo "📝 User input: $confirm"
if [[ "$confirm" == "y" || "$confirm" == "yes" ]]; then
echo "✅ User agreed. Running make_my_docs_bot..."
# Display banner
cat << 'EOF'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
███╗ ███╗ █████╗ ██╗ ██╗███████╗ ███╗ ███╗██╗ ██╗
████╗ ████║██╔══██╗██║ ██╔╝██╔════╝ ████╗ ████║╚██╗ ██╔╝
██╔████╔██║███████║█████╔╝ █████╗ ██╔████╔██║ ╚████╔╝
██║╚██╔╝██║██╔══██║██╔═██╗ ██╔══╝ ██║╚██╔╝██║ ╚██╔╝
██║ ╚═╝ ██║██║ ██║██║ ██╗███████╗ ██║ ╚═╝ ██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝
██████╗ ██████╗ ██████╗███████╗ ██████╗ ██████╗ ████████╗
██╔══██╗██╔═══██╗██╔════╝██╔════╝ ██╔══██╗██╔═══██╗╚══██╔══╝
██║ ██║██║ ██║██║ ███████╗ ██████╔╝██║ ██║ ██║
██║ ██║██║ ██║██║ ╚════██║ ██╔══██╗██║ ██║ ██║
██████╔╝╚██████╔╝╚██████╗███████║ ██████╔╝╚██████╔╝ ██║
╚═════╝ ╚═════╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
# Navigate into the package directory
echo "📂 Changing directory to make_my_docs_bot"
cd MAKE_MY_DOCS_BOT || { echo "❌ Failed to cd into make_my_docs_bot"; exit 1; }
echo "✅ Current directory: $(pwd)"
# Activate virtual environment
echo "⚡ Activating virtual environment..."
source .venv/bin/activate || { echo "❌ Failed to activate virtual environment"; exit 1; }
echo "✅ Virtual environment activated: $VIRTUAL_ENV"
# Run the uv command with branch
echo "▶️ Invoking Make My Docs Bot"
uv run run_crew --branch_name "$branch"
# Check command result
if [[ $? -ne 0 ]]; then
echo "⚠️ make_my_docs_bot failed. Push canceled."
exit 1
else
echo "✅ make_my_docs_bot completed successfully."
fi
else
echo "❌ User chose to skip make_my_docs_bot."
fi
echo "🚀 Proceeding with git push..."
exit 0