feat: add GitHub stars verification to sync script

Added automatic verification of GitHub stars count:
- Fetches actual count from GitHub API
- Compares with landing index.html badge
- Tolerance: ±10% or ±10 stars (whichever is larger)
- Prevents future mismatches like 1.2k vs 60

Verification output example:
  Actual (GitHub API): 60
  Landing (index.html): 60
  ✓ OK (within tolerance: ±10)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Florian BRUNIAUX 2026-01-27 12:45:18 +01:00
parent c198cf2645
commit bd193cf73a

View file

@ -2,7 +2,7 @@
# Check if landing site is in sync with guide
# Usage: ./scripts/check-landing-sync.sh
#
# Verifies: Version, Templates count, Quiz questions, Guide lines
# Verifies: Version, Templates count, Quiz questions, Guide lines, Claude Code version, GitHub stars
set -e
@ -156,6 +156,45 @@ else
fi
echo ""
# ===================
# 6. GITHUB STARS COUNT
# ===================
# Fetch actual stars count from GitHub API (public, no auth needed)
ACTUAL_STARS=$(curl -s https://api.github.com/repos/FlorianBruniaux/claude-code-ultimate-guide 2>/dev/null | grep -oE '"stargazers_count": [0-9]+' | grep -oE '[0-9]+')
# Extract stars from landing (badge-stars section)
LANDING_STARS=$(grep -A2 'badge badge-stars' "$LANDING_DIR/index.html" | grep 'badge-value' | grep -oE '[0-9]+(\.[0-9]+)?k?' | sed 's/k/000/' | sed 's/\.//g')
echo -e "${BLUE}6. GitHub Stars Count${NC}"
echo " Actual (GitHub API): ${ACTUAL_STARS:-N/A}"
echo " Landing (index.html): ${LANDING_STARS:-N/A}"
if [ -z "$ACTUAL_STARS" ]; then
echo -e " ${YELLOW}WARNING${NC}: Could not fetch from GitHub API (check connection)"
elif [ -z "$LANDING_STARS" ]; then
echo -e " ${RED}ERROR${NC}: Could not extract stars from landing"
ISSUES=$((ISSUES + 1))
else
# Allow some tolerance for display format (e.g., 1.2k = 1200, 60 = 60)
# Compare as integers
DIFF=$((ACTUAL_STARS - LANDING_STARS))
DIFF_ABS=${DIFF#-} # absolute value
# Tolerance: ±10% or ±10 stars (whichever is larger)
TOLERANCE=$((ACTUAL_STARS / 10))
if [ $TOLERANCE -lt 10 ]; then
TOLERANCE=10
fi
if [ $DIFF_ABS -gt $TOLERANCE ]; then
echo -e " ${RED}MISMATCH${NC} → Update index.html badge-stars section (line ~281)"
ISSUES=$((ISSUES + 1))
else
echo -e " ${GREEN}OK${NC} (within tolerance: ±${TOLERANCE})"
fi
fi
echo ""
# ===================
# SUMMARY
# ===================