@@ -105,39 +105,6 @@ function isNewVersion(
105
105
return $true
106
106
}
107
107
108
- function Get-GitHubApiHeaders {
109
- # Use GitHub cli to get an auth token if available
110
- $token = " "
111
- if (Get-Command gh - ErrorAction SilentlyContinue) {
112
- try
113
- {
114
- $token = gh auth token 2> $null
115
- }
116
- catch
117
- {
118
- Write-Host " Failed to get GitHub CLI auth token."
119
- }
120
- }
121
-
122
- # Get token from env if not available from gh cli
123
- if (! $token )
124
- {
125
- Write-Host " Checking for GITHUB_TOKEN environment variable."
126
- $token = $env: GITHUB_TOKEN
127
- }
128
-
129
- if ($token )
130
- {
131
- Write-Host " Using authenticated GitHub API requests."
132
- $headers = @ {
133
- Authorization = " Bearer $token "
134
- }
135
- return $headers
136
- }
137
- Write-Host " Using unauthenticated GitHub API requests."
138
- return @ {}
139
- }
140
-
141
108
<#
142
109
. SYNOPSIS
143
110
Installs a standalone version of an engsys tool.
@@ -168,12 +135,11 @@ function Install-Standalone-Tool (
168
135
}
169
136
170
137
$tag = " ${Package} _${Version} "
171
- $headers = Get-GitHubApiHeaders
172
138
173
139
if (! $Version -or $Version -eq " *" ) {
174
140
Write-Host " Attempting to find latest version for package '$Package '"
175
141
$releasesUrl = " https://api.github.com/repos/$Repository /releases"
176
- $releases = Invoke-RestMethod - Uri $releasesUrl - Headers $headers
142
+ $releases = Invoke-RestMethod - Uri $releasesUrl
177
143
$found = $false
178
144
foreach ($release in $releases ) {
179
145
if ($release.tag_name -like " $Package *" ) {
@@ -197,7 +163,7 @@ function Install-Standalone-Tool (
197
163
198
164
if (isNewVersion $version $downloadFolder ) {
199
165
Write-Host " Installing '$Package ' '$Version ' to '$downloadFolder ' from $downloadUrl "
200
- Invoke-WebRequest - Uri $downloadUrl - OutFile $downloadLocation - Headers $headers
166
+ Invoke-WebRequest - Uri $downloadUrl - OutFile $downloadLocation
201
167
202
168
if ($downloadFile -like " *.zip" ) {
203
169
Expand-Archive - Path $downloadLocation - DestinationPath $downloadFolder - Force
0 commit comments