We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f3948f commit 134926bCopy full SHA for 134926b
1 file changed
scripts/lib/Autopilot.Common.psm1
@@ -35,9 +35,16 @@ function Invoke-Gh {
35
36
function Invoke-GhJson {
37
param([string[]]$Args)
38
- $json = gh @Args
+ $json = gh @Args 2>$null
39
if (-not $json) { return $null }
40
- return $json | ConvertFrom-Json
+ $trimmed = $json.Trim()
41
+ $objIndex = $trimmed.IndexOf('{')
42
+ $arrIndex = $trimmed.IndexOf('[')
43
+ $start = @($objIndex, $arrIndex) | Where-Object { $_ -ge 0 } | Sort-Object | Select-Object -First 1
44
+ if ($start -gt 0) {
45
+ $trimmed = $trimmed.Substring($start)
46
+ }
47
+ return $trimmed | ConvertFrom-Json
48
}
49
50
function Get-RepoName {
0 commit comments