- Reset master to upstream/main (16,697 commits) - Overlay 2,271 local-only files (skills, tools, workspace, configs, apps) - Restore IDENTITY.md and USER.md templates - Build verified, gateway running, Discord working Co-Authored-By: Claude Opus 4.6 <[email protected]>
59 lines
1.8 KiB
Bash
59 lines
1.8 KiB
Bash
#!/bin/bash
|
|
# GitHub → Kanban Daily Sync
|
|
# Scans GitHub for OpenClaw repos and imports quality builds (2+ stars)
|
|
|
|
set -euo pipefail
|
|
|
|
LOG_DIR="/home/alex/clawd/logs"
|
|
TOOLS_DIR="/home/alex/clawd/tools"
|
|
WORK_DIR="/tmp"
|
|
|
|
DATE=$(date +%Y%m%d)
|
|
SCAN_FILE="$WORK_DIR/github-scan-$DATE.jsonl"
|
|
CLEAN_FILE="$WORK_DIR/github-clean-$DATE.jsonl"
|
|
LOG_FILE="$LOG_DIR/github-import.log"
|
|
|
|
mkdir -p "$LOG_DIR"
|
|
|
|
log() {
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOG_FILE"
|
|
}
|
|
|
|
log "=== GitHub Daily Sync Started ==="
|
|
|
|
# Step 1: Scan GitHub
|
|
log "Step 1: Scanning GitHub for OpenClaw repos..."
|
|
if python3 "$TOOLS_DIR/github_openclaw_scanner.py" > "$SCAN_FILE" 2>&1; then
|
|
TOTAL=$(wc -l < "$SCAN_FILE")
|
|
log "✅ Found $TOTAL repositories"
|
|
else
|
|
log "❌ GitHub scan failed"
|
|
exit 1
|
|
fi
|
|
|
|
# Step 2: Clean JSONL (remove non-JSON lines)
|
|
log "Step 2: Cleaning JSONL output..."
|
|
grep '^{' "$SCAN_FILE" > "$CLEAN_FILE" || true
|
|
CLEAN_COUNT=$(wc -l < "$CLEAN_FILE")
|
|
log "✅ Cleaned: $CLEAN_COUNT valid JSON lines"
|
|
|
|
# Step 3: Import to Kanban (min 2 stars)
|
|
log "Step 3: Importing to Kanban (min 2 stars)..."
|
|
if RESULT=$(python3 "$TOOLS_DIR/github_to_kanban.py" --min-stars 2 "$CLEAN_FILE" 2>&1); then
|
|
CREATED=$(echo "$RESULT" | jq -r '.created // 0' 2>/dev/null || echo "0")
|
|
SKIPPED=$(echo "$RESULT" | jq -r '.skipped // 0' 2>/dev/null || echo "0")
|
|
|
|
log "✅ Import complete: $CREATED created, $SKIPPED skipped"
|
|
echo "$RESULT" | jq '.' >> "$LOG_FILE" 2>/dev/null || true
|
|
else
|
|
log "❌ Import failed: $RESULT"
|
|
exit 1
|
|
fi
|
|
|
|
# Step 4: Cleanup old files (keep 7 days)
|
|
log "Step 4: Cleanup old scan files..."
|
|
find "$WORK_DIR" -name "github-scan-*.jsonl" -mtime +7 -delete 2>/dev/null || true
|
|
find "$WORK_DIR" -name "github-clean-*.jsonl" -mtime +7 -delete 2>/dev/null || true
|
|
|
|
log "=== GitHub Daily Sync Complete: $CREATED new tasks ==="
|