Makes dump_commits_since.ps1 work on PowerShell 5.1 (#7680)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user