CoolFace
Apppublic

LZ-SG/embedded-dev-tutorials

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
push_v180.ps124 linesDownload Raw Back to root
1$TOKEN = "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"2$api = "https://api.github.com/repos/SG06231219-boop/embedded-dev-tutorials/contents"3$base = "C:\Users\LYS\.qclaw\workspace\embedded-dev-site"4$headers = @{Authorization="token $TOKEN"; Accept="application/vnd.github.v3+json"; "User-Agent"="push-v180"}5 6$files = @("static/index.html", "app.py")7$msg = "v1.8.0: floating TOC sidebar + scroll-spy"8 9foreach ($f in $files) {10    $local = Join-Path $base $f11    $content = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes((Get-Content $local -Raw)))12    try { $sha = (Invoke-RestMethod "$api/$($f)?ref=main" -Headers $headers -TimeoutSec 10).sha } catch { $sha = $null }13    $body = @{message=$msg; content=$content; branch="main"}14    if ($sha) { $body.sha = $sha }15    try {16        $r = Invoke-RestMethod -Method Put "$api/$f" -Headers $headers -Body ($body|ConvertTo-Json -Depth 2) -ContentType "application/json" -TimeoutSec 3017        Write-Host "OK $f"18    } catch {19        Write-Host "FAIL $f : $($_.Exception.Message)"20    }21    Start-Sleep -Milliseconds 50022}23Write-Host "Done"24