Merge pull request #9 from actions/v-mazhuk/increase-releases-limit
Increase the number of releases received by API
This commit is contained in:
commit
4a09a7e348
|
@ -60,9 +60,26 @@ class GitHubApi
|
||||||
return $this.InvokeRestMethod($url, 'Post', $null, $requestBody)
|
return $this.InvokeRestMethod($url, 'Post', $null, $requestBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
[object] GetGitHubReleases(){
|
[array] GetReleases(){
|
||||||
$url = "releases"
|
$url = "releases"
|
||||||
return $this.InvokeRestMethod($url, 'GET', $null, $null)
|
$releases = @()
|
||||||
|
$pageNumber = 1
|
||||||
|
$releaseNumberLimit = 10000
|
||||||
|
|
||||||
|
while ($releases.Count -le $releaseNumberLimit)
|
||||||
|
{
|
||||||
|
$requestParams = "page=${pageNumber}&per_page=100"
|
||||||
|
[array] $response = $this.InvokeRestMethod($url, 'GET', $requestParams, $null)
|
||||||
|
|
||||||
|
if ($response.Count -eq 0) {
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
$releases += $response
|
||||||
|
$pageNumber++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $releases
|
||||||
}
|
}
|
||||||
|
|
||||||
[string] hidden BuildUrl([string]$Url, [string]$RequestParams) {
|
[string] hidden BuildUrl([string]$Url, [string]$RequestParams) {
|
||||||
|
|
|
@ -153,6 +153,6 @@ function Build-VersionsManifest {
|
||||||
}
|
}
|
||||||
|
|
||||||
$gitHubApi = Get-GitHubApi -AccountName $GitHubRepositoryOwner -ProjectName $GitHubRepositoryName -AccessToken $GitHubAccessToken
|
$gitHubApi = Get-GitHubApi -AccountName $GitHubRepositoryOwner -ProjectName $GitHubRepositoryName -AccessToken $GitHubAccessToken
|
||||||
$releases = $gitHubApi.GetGitHubReleases()
|
$releases = $gitHubApi.GetReleases()
|
||||||
$versionIndex = Build-VersionsManifest $releases
|
$versionIndex = Build-VersionsManifest $releases
|
||||||
$versionIndex | ConvertTo-Json -Depth 5 | Out-File $OutputFile -Encoding UTF8NoBOM -Force
|
$versionIndex | ConvertTo-Json -Depth 5 | Out-File $OutputFile -Encoding UTF8NoBOM -Force
|
||||||
|
|
Loading…
Reference in New Issue