Skip to content

Commit d9d29a0

Browse files
committed
Remove usage of github token for auth
- This is generated for the repo running the action, it can't be used for this request.
1 parent 210b44d commit d9d29a0

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

install-nf-build-components.ps1

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,14 @@ try
3838
}
3939
catch
4040
{
41+
$result = $_.Exception.Response.GetResponseStream()
42+
$reader = New-Object System.IO.StreamReader($result)
43+
$reader.BaseStream.Position = 0
44+
$reader.DiscardBufferedData()
45+
$responseBody = $reader.ReadToEnd()
4146

42-
# assume exception is with try with GITHUB_TOKEN
43-
if($env:GITHUB_TOKEN)
44-
{
45-
Write-Output "INFO: 2nd try using GITHUB TOKEN"
46-
47-
# authorization header with github token
48-
$auth = "Bearer $env:GITHUB_TOKEN"
49-
50-
$webClient.Headers.Remove("Authorization")
51-
$webClient.Headers.Add("Authorization", $auth)
52-
53-
$releaseList = $webClient.DownloadString('https://api.github.com/repos/nanoframework/nf-Visual-Studio-extension/releases?per_page=100')
54-
}
55-
else
56-
{
57-
$result = $_.Exception.Response.GetResponseStream()
58-
$reader = New-Object System.IO.StreamReader($result)
59-
$reader.BaseStream.Position = 0
60-
$reader.DiscardBufferedData()
61-
$responseBody = $reader.ReadToEnd()
62-
63-
Write-Output "🛑 performing request: $responseBody"
64-
exit 1
65-
}
47+
Write-Output "🛑 performing request: $responseBody"
48+
exit 1
6649
}
6750

6851
if($releaseList -match '\"(?<VS2022_version>v2022\.\d+\.\d+\.\d+)\"')

0 commit comments

Comments
 (0)