Skip to content

Commit

Permalink
Fix query batch processing (#15319)
Browse files Browse the repository at this point in the history
Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
  • Loading branch information
azure-sdk and weshaggard committed Aug 18, 2021
1 parent 0954eba commit 060da49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Invoke-Query($fields, $wiql, $output = $true)
-Uri "https://dev.azure.com/azure-sdk/Release/_apis/wit/wiql/?`$top=10000&api-version=6.0" `
-Headers (Get-DevOpsRestHeaders) -Body $body -ContentType "application/json" | ConvertTo-Json -Depth 10 | ConvertFrom-Json -AsHashTable

if ($response -isnot [HashTable] -or !$response.ContainsKey("workItems")) {
if ($response -isnot [HashTable] -or !$response.ContainsKey("workItems") -or $response.workItems.Count -eq 0) {
Write-Verbose "Query returned no items. $wiql"
return ,@()
}
Expand All @@ -83,11 +83,11 @@ function Invoke-Query($fields, $wiql, $output = $true)
Write-Verbose "Pulling work items $uri "

$batchResponse = Invoke-RestMethod -Method GET -Uri $uri `
-Headers $headers -ContentType "application/json" -MaximumRetryCount 3 | ConvertTo-Json -Depth 10 | ConvertFrom-Json -AsHashTable
-Headers (Get-DevOpsRestHeaders) -ContentType "application/json" -MaximumRetryCount 3 | ConvertTo-Json -Depth 10 | ConvertFrom-Json -AsHashTable

if ($batchResponse.value)
{
$batchResponse.value | % { $workItems += $_ }
$batchResponse.value | ForEach-Object { $workItems += $_ }
}
else
{
Expand Down

0 comments on commit 060da49

Please sign in to comment.