# Taiwan Lottery Auto Update & Push to HuggingFace # Run this via Windows Task Scheduler at 21:00 daily $ProjectDir = "C:\Users\denni\.gemini\antigravity\scratch" $LogFile = "$ProjectDir\logs\auto_push.log" # Create logs dir if needed New-Item -ItemType Directory -Force -Path "$ProjectDir\logs" | Out-Null function Log($msg) { $ts = Get-Date -Format "yyyy-MM-dd HH:mm:ss" "$ts $msg" | Tee-Object -FilePath $LogFile -Append } Log "=== Auto update started ===" Set-Location $ProjectDir # Run 539 scraper Log "Running 539 scraper..." node scraper.js >> $LogFile 2>&1 if ($LASTEXITCODE -ne 0) { Log "ERROR: 539 scraper failed (exit $LASTEXITCODE)" } else { Log "Running 539 backtest..." node backtest.js >> $LogFile 2>&1 } # Run 649 scraper (Mon=1, Thu=4 only) $dow = [int](Get-Date).DayOfWeek # 0=Sun,1=Mon,...,4=Thu if ($dow -eq 1 -or $dow -eq 4) { Log "Running 649 scraper (Mon/Thu)..." node scraper649.js >> $LogFile 2>&1 if ($LASTEXITCODE -ne 0) { Log "ERROR: 649 scraper failed (exit $LASTEXITCODE)" } else { Log "Running 649 backtest..." node backtest649.js >> $LogFile 2>&1 } } else { Log "Skipping 649 (not Mon/Thu, today=$dow)" } # Git push to HuggingFace Log "Pushing to HuggingFace..." git add lottery_539_data.json lottery_539_history.md backtest_results.json git add lottery_649_data.json lottery_649_history.md backtest_results_649.json 2>$null git commit -m "data: auto update $(Get-Date -Format 'yyyy-MM-dd HH:mm')" >> $LogFile 2>&1 git push hf master:main >> $LogFile 2>&1 if ($LASTEXITCODE -eq 0) { Log "Push successful!" } else { Log "Push failed (exit $LASTEXITCODE)" } Log "=== Done ==="