[READ-ONLY] Mirror of https://github.com/mrgnw/cv.
1#!/bin/bash
2
3# Simple Git Trigger Watcher
4# Just watches for .git-trigger and runs git operations
5
6echo "👀 Watching for git triggers..."
7
8while true; do
9 if [ -f ".git-trigger" ]; then
10 echo "🔔 Git trigger detected!"
11
12 # Remove trigger file
13 rm -f .git-trigger
14
15 # Wait a moment for any file operations to complete
16 sleep 2
17
18 # Check for PDF changes
19 if git status --porcelain static/ .pdf-cache.json | grep -E '\.(pdf|json)$' > /dev/null; then
20 echo "📋 PDF changes detected, committing..."
21
22 # Add PDFs and cache
23 git add static/*.pdf static/sans/*.pdf .pdf-cache.json 2>/dev/null || true
24
25 # Commit
26 TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
27 git commit -m "Update PDFs and cache - $TIMESTAMP"
28
29 # Push
30 BRANCH=$(git rev-parse --abbrev-ref HEAD)
31 git push origin "$BRANCH"
32
33 echo "✅ Git operations completed"
34 else
35 echo "ℹ️ No PDF changes to commit"
36 fi
37 fi
38
39 sleep 2
40done