Skip to content

Commit

Permalink
Fix Windows PowerShell support for processing API call
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Aug 10, 2021
1 parent f97794d commit b09c145
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions build.ps1
@@ -1,6 +1,6 @@
[cmdletbinding()]
param(
[ValidateSet('Debug','Release','Prerelease')]
[ValidateSet('Debug','Release','Prerelease','PSGalleryRetry')]
[string]
$Configuration,

Expand Down Expand Up @@ -181,7 +181,7 @@ task build {
Invoke-Expression "gh config set prompt disabled"
}

if ($Configuration -eq 'Release') {
if ($Configuration -eq 'Release' -or ($Configuration -eq 'PSGalleryRetry')) {
$foundModule = Find-Module -Name $moduleName
if ($foundModule.Version -ge $imported.Version) {
throw "PowerShell Gallery version of $moduleName is more recent ($($foundModule.Version) >= $($imported.Version))"
Expand Down Expand Up @@ -210,18 +210,20 @@ task build {
$ghArgs = $ghArgs + " --prerelease"
}

if (Test-Path $changeLog) {
Write-Output "gh command to execute: $ghArgs"
Invoke-Expression "gh $ghArgs"
} else {
throw "release.md file not found"
if ($Configuration -ne 'PSGalleryRetry') {
if (Test-Path $changeLog) {
Write-Output "gh command to execute: $ghArgs"
Invoke-Expression "gh $ghArgs"
} else {
throw "release.md file not found"
}
}

if ((gh config get prompt) -eq 'disabled') {
Invoke-Expression "gh config set prompt enabled"
}

if ($Configuration -eq 'Release') {
if ($Configuration -eq 'Release' -and ($Configuration -ne 'PSGalleryRetry')) {
try {
$testAzAccount = az account list | ConvertFrom-Json
} catch {
Expand Down
2 changes: 1 addition & 1 deletion src/parts/ProcessResponse.ps1
Expand Up @@ -6,7 +6,7 @@ param(
)

if ($Response.Content.StartsWith("{") -and $Response.Content.EndsWith("}")) {
$content = $Response.Content | ConvertFrom-Json -Depth 50
$content = $Response.Content | ConvertFrom-Json
} else {
$content = $Response.Content
}
Expand Down

0 comments on commit b09c145

Please sign in to comment.