Send authenticated request to query release tags (#3309)

Co-authored-by: Praveen Kuttappan <praveen.kuttappan@gmail.com>
This commit is contained in:
Azure SDK Bot 2022-02-04 08:56:19 -08:00 committed by GitHub
parent 9c79a0725d
commit 514080fa0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,10 @@ function CreateReleases($pkgList, $releaseApiUrl, $releaseSha) {
# Retrieves the list of all tags that exist on the target repository
function GetExistingTags($apiUrl) {
try {
return (Invoke-RestMethod -Method "GET" -Uri "$apiUrl/git/refs/tags" -MaximumRetryCount 3 -RetryIntervalSec 10) | % { $_.ref.Replace("refs/tags/", "") }
$headers = @{
"Authorization" = "token $($env:GH_TOKEN)"
}
return (Invoke-RestMethod -Method "GET" -Uri "$apiUrl/git/refs/tags" -Headers $headers -MaximumRetryCount 3 -RetryIntervalSec 10) | % { $_.ref.Replace("refs/tags/", "") }
}
catch {
Write-Host $_