CoolFace
Apppublic

LZ-SG/embedded-dev-tutorials

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
push_v162.ps152 linesDownload Raw Back to root
1$ErrorActionPreference = "Stop"2$TOKEN = "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"3$headers = @{Authorization="token $TOKEN"; Accept="application/vnd.github.v3+json"; "User-Agent"="push-v162"}4$api = "https://api.github.com/repos/SG06231219-boop/embedded-dev-tutorials/contents"5$base = "C:\Users\LYS\.qclaw\workspace\embedded-dev-site"6 7$files = @(8    "static/tutorials/guide/guide-ch00.html",9    "static/tutorials/guide/guide-ch01.html",10    "static/tutorials/guide/guide-ch02.html",11    "static/tutorials/guide/guide-ch03.html",12    "static/tutorials/guide/guide-ch04.html",13    "static/tutorials/guide/guide-ch05.html",14    "static/tutorials/guide/guide-ch06.html",15    "static/tutorials/guide/guide-ch07.html",16    "static/tutorials/guide/guide-ch08.html",17    "static/tutorials/guide/guide-ch09.html",18    "static/tutorials/guide/guide-ch10.html",19    "static/tutorials/guide/guide-ch11.html",20    "static/tutorials/guide/guide-ch12.html",21    "static/tutorials/guide/guide-ch13.html",22    "static/index.html"23)24 25$ok = 0; $fail = 026foreach ($f in $files) {27    $local = Join-Path $base $f28    if (-not (Test-Path $local)) { Write-Host "SKIP $f (not found)"; continue }29    30    $content = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes((Get-Content $local -Raw)))31    32    # Get SHA33    try {34        $sha = (Invoke-RestMethod "$api/$($f)?ref=main" -Headers $headers -TimeoutSec 10).sha35    } catch { $sha = $null }36    37    $body = @{message="v1.6.2: guide expansion + SPA reading mode"; content=$content; branch="main"} 38    if ($sha) { $body.sha = $sha }39    $json = $body | ConvertTo-Json -Depth 240    41    try {42        $r = Invoke-RestMethod -Method Put "$api/$f" -Headers $headers -Body $json -ContentType "application/json" -TimeoutSec 3043        Write-Host "✅ $f ($($r.commit.sha.Substring(0,7)))"44        $ok++45    } catch {46        Write-Host "❌ $f : $($_.Exception.Message)"47        $fail++48    }49    Start-Sleep -Milliseconds 50050}51Write-Host "`nDone: $ok OK, $fail FAIL"52