Makes dump_commits_since.ps1 work on PowerShell 5.1 (#7680)

This commit is contained in:
ike709
2022-04-21 02:39:02 -05:00
committed by GitHub
parent 20fb3406e8
commit 9757382aaf

View File

@@ -13,9 +13,12 @@ param(
$r = @() $r = @()
$page = 1
$qParams = @{ $qParams = @{
"since" = $since.ToString("o"); "since" = $since.ToString("o");
"per_page" = 100 "per_page" = 100
"page" = $page
} }
if ($until -ne $null) { if ($until -ne $null) {
@@ -24,11 +27,19 @@ if ($until -ne $null) {
$url = "https://api.github.com/repos/{0}/commits" -f $repo $url = "https://api.github.com/repos/{0}/commits" -f $repo
while ($null -ne $url) while ($null -ne $url)
{ {
$resp = Invoke-WebRequest $url -Body $qParams $resp = Invoke-WebRequest $url -UseBasicParsing -Body $qParams
$url = $resp.RelationLink.next if($resp.Content.Length -eq 2) {
break
}
$page += 1
$qParams["page"] = $page
$j = ConvertFrom-Json $resp.Content $j = ConvertFrom-Json $resp.Content
$r += $j $r += $j