Skip to content

Commit

Permalink
improve $commandOutput processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad Jamrozik committed Feb 14, 2023
1 parent 27e6aba commit 3a85471
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions eng/common/scripts/get-codeowners.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ function Get-Codeowners(
return ,@()
}

# Assert: $commandOutput is a valid JSON representing a single CodeownersEntry, or an empty string.
# Assert: $commandOutput is a valid JSON representing:
# - a single CodeownersEntry, if the $targetPath was a single path
# - or a dictionary of CodeownerEntries, keyes by each path resolved from a $targetPath glob path.
#
# For implementation details, see Azure.Sdk.Tools.RetrieveCodeOwners.Program.Main

$codeownersJson = $commandOutput | ConvertFrom-Json
if (!$codeownersJson) {
Write-Host "No code owners returned for the path: $targetPath"
return ,@()
}
$codeownersJson = $commandOutput | ConvertFrom-Json

if ($VsoVariable) {
$codeowners = $codeownersJson.Owners -join ","
Expand Down

0 comments on commit 3a85471

Please sign in to comment.