Skip to content

Commit bad95f4

Browse files
committed
minor updates
1 parent 099c2e2 commit bad95f4

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

GitHubReleases.ps1

+14-13
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ function Get-GitHubRelease
152152

153153
Write-InvocationLog -Invocation $MyInvocation
154154

155-
$elements = Resolve-RepositoryElements -BoundParameters $PSBoundParameters -DisableValidation
155+
$elements = Resolve-RepositoryElements -BoundParameters $PSBoundParameters
156156
$OwnerName = $elements.ownerName
157157
$RepositoryName = $elements.repositoryName
158158

159-
$telemetryProperties = @{}
160-
161-
$telemetryProperties['OwnerName'] = Get-PiiSafeString -PlainText $OwnerName
162-
$telemetryProperties['RepositoryName'] = Get-PiiSafeString -PlainText $RepositoryName
159+
$telemetryProperties = @{
160+
'OwnerName' = (Get-PiiSafeString -PlainText $OwnerName)
161+
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
162+
}
163163

164164
$uriFragment = "repos/$OwnerName/$RepositoryName/releases"
165165
$description = "Getting releases for $OwnerName/$RepositoryName"
@@ -854,13 +854,7 @@ function New-GitHubReleaseAsset
854854

855855
Write-InvocationLog
856856

857-
$elements = Resolve-RepositoryElements -DisableValidation
858-
$OwnerName = $elements.ownerName
859-
$RepositoryName = $elements.repositoryName
860-
861857
$telemetryProperties = @{
862-
'OwnerName' = (Get-PiiSafeString -PlainText $OwnerName)
863-
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
864858
'ProvidedUploadUrl' = (-not [String]::IsNullOrWhiteSpace($UploadUrl))
865859
'ProvidedLabel' = (-not [String]::IsNullOrWhiteSpace($Label))
866860
'ProvidedContentType' = (-not [String]::IsNullOrWhiteSpace($ContentType))
@@ -869,8 +863,15 @@ function New-GitHubReleaseAsset
869863
# If UploadUrl wasn't provided, we'll need to query for it first.
870864
if ($PSCmdlet.ParameterSetName -in ('Elements', 'Uri'))
871865
{
872-
$info = Get-GitHubRelease -OwnerName $OwnerName -RepositoryName $RepositoryName -Release $Release -AccessToken:$AccessToken -NoStatus:$NoStatus
873-
$UploadUrl = $info.upload_url
866+
$elements = Resolve-RepositoryElements
867+
$OwnerName = $elements.ownerName
868+
$RepositoryName = $elements.repositoryName
869+
870+
$telemetryProperties['OwnerName'] = (Get-PiiSafeString -PlainText $OwnerName)
871+
$telemetryProperties['RepositoryName'] = (Get-PiiSafeString -PlainText $RepositoryName)
872+
873+
$releaseInfo = Get-GitHubRelease -OwnerName $OwnerName -RepositoryName $RepositoryName -Release $Release -AccessToken:$AccessToken -NoStatus:$NoStatus
874+
$UploadUrl = $releaseInfo.upload_url
874875
}
875876

876877
# Remove the '{name,label}' from the Url if it's there

0 commit comments

Comments
 (0)