Skip to content

Commit f824e8c

Browse files
authored
CI/CD: Fix GitHub powershell scripts (#130)
Fixes #100
1 parent eb21d76 commit f824e8c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Scripts/Library/GithubHelpers.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ function ReadGitRemoteUrl([string] $from, [string] $remoteName) {
120120

121121
if ($remoteUrl.StartsWith("ssh://")) {
122122
$remoteUrl = $remoteUrl.Replace("ssh://", "")
123+
$remoteUrl = $remoteUrl.Replace(":", "/")
123124
}
124125

125126
if ($remoteUrl.StartsWith("git@")) {
126127
$remoteUrl = $remoteUrl.Replace("git@", "")
128+
$remoteUrl = $remoteUrl.Replace(":", "/")
127129
}
128130

129131
if ($remoteUrl.EndsWith(".git")) {
@@ -241,7 +243,7 @@ function PublishGitRelease([string] $from, [string] $tag, [string] $name, [strin
241243
# Step 1
242244
$url = "https://$gitBaseUrl/repos/$owner/$repoName/releases/tags/$tag"
243245
$response = try {
244-
Invoke-WebRequest -Uri $url -Method Get -Headers @{
246+
Invoke-WebRequest -UseBasicParsing -Uri $url -Method Get -Headers @{
245247
"Authorization" = "token $env:GITHUB_TOKEN"
246248
} -ErrorAction SilentlyContinue
247249
}
@@ -281,7 +283,7 @@ function PublishGitRelease([string] $from, [string] $tag, [string] $name, [strin
281283
Write-Host "Payload: $jsonEncodedPayload" -ForegroundColor Yellow
282284

283285
$response = try {
284-
Invoke-WebRequest -Uri $url -Method POST -Body $jsonEncodedPayload -Headers @{
286+
Invoke-WebRequest -UseBasicParsing -Uri $url -Method POST -Body $jsonEncodedPayload -Headers @{
285287
"Authorization" = "token $env:GITHUB_TOKEN"
286288
"Accept" = "application/vnd.github.v3+json"
287289
"Content-Type" = "application/json"
@@ -320,7 +322,7 @@ function PublishGitRelease([string] $from, [string] $tag, [string] $name, [strin
320322

321323
$bytes = [System.IO.File]::ReadAllBytes($file)
322324

323-
Invoke-RestMethod -Method PUT -Uri $url -Headers @{
325+
Invoke-RestMethod -UseBasicParsing -Method PUT -Uri $url -Headers @{
324326
"Authorization" = "token $env:GITHUB_TOKEN"
325327
"Accept" = "application/vnd.github.v3+json"
326328
"Content-Type" = "application/octet-stream"
@@ -335,7 +337,7 @@ function PublishGitRelease([string] $from, [string] $tag, [string] $name, [strin
335337

336338
$jsonEncodedPayload = ConvertTo-Json -InputObject $payload
337339
$response = try {
338-
Invoke-WebRequest -Uri $url -Method PATCH -Body $jsonEncodedPayload -Headers @{
340+
Invoke-WebRequest -UseBasicParsing -Uri $url -Method PATCH -Body $jsonEncodedPayload -Headers @{
339341
"Authorization" = "token $env:GITHUB_TOKEN"
340342
"Accept" = "application/vnd.github.v3+json"
341343
"Content-Type" = "application/json"

0 commit comments

Comments
 (0)