-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_hooks.sh
More file actions
31 lines (24 loc) · 883 Bytes
/
setup_hooks.sh
File metadata and controls
31 lines (24 loc) · 883 Bytes
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
#!/bin/bash
# Setup Git hooks for automatic documentation updates
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HOOKS_DIR="$REPO_ROOT/.githooks"
GIT_HOOKS_DIR="$REPO_ROOT/.git/hooks"
echo "🔧 Setting up Git hooks..."
# Create .git/hooks if it doesn't exist
mkdir -p "$GIT_HOOKS_DIR"
# Copy hooks
cp "$HOOKS_DIR/post-commit" "$GIT_HOOKS_DIR/post-commit"
cp "$HOOKS_DIR/pre-push" "$GIT_HOOKS_DIR/pre-push"
# Make executable
chmod +x "$GIT_HOOKS_DIR/post-commit"
chmod +x "$GIT_HOOKS_DIR/pre-push"
# Configure Git to use custom hooks directory
git config core.hooksPath .githooks
echo "✅ Git hooks installed successfully"
echo ""
echo "Hooks configured:"
echo " - post-commit: Updates documentation after each commit"
echo " - pre-push: Verifies documentation before pushing"
echo ""
echo "To manually run documentation update:"
echo " python3 update_docs.py"