diff --git a/github/create-release.ps1 b/github/create-release.ps1 index 2dcc18d..b7cd2ab 100644 --- a/github/create-release.ps1 +++ b/github/create-release.ps1 @@ -62,7 +62,6 @@ function Validate-ReleaseAvailability { Write-Host "Release was successfully created: $($createdRelease.html_url)" return } - $RetryCount $RetryCount-- Start-Sleep -Seconds $RetryIntervalSec diff --git a/github/github-api.psm1 b/github/github-api.psm1 index d939104..496d211 100644 --- a/github/github-api.psm1 +++ b/github/github-api.psm1 @@ -103,14 +103,17 @@ class GitHubApi return $this.InvokeRestMethod($url, 'GET', $null, $null) } - [void] CreateWorkflowDispatch([string]$WorkflowFileName, [string]$Ref, [object]$Inputs) { + [void] CreateWorkflowDispatch([string]$WorkflowFileName, [string]$Ref, [string]$Inputs) { $url = "actions/workflows/${WorkflowFileName}/dispatches" - $body = @{ - ref = $Ref - inputs = $Inputs - } | ConvertTo-Json + $body = @{ ref = $Ref } + + if ($Inputs) { + $body.inputs = $Inputs + } - $this.InvokeRestMethod($url, 'POST', $null, $body) + $jsonBody = $body | ConvertTo-Json + + $this.InvokeRestMethod($url, 'POST', $null, $jsonBody) } [string] hidden BuildUrl([string]$Url, [string]$RequestParams) {