Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardWolosky committed May 31, 2020
1 parent 4ac4951 commit 82d5455
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions GitHubReleases.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ function Get-GitHubRelease

Write-InvocationLog -Invocation $MyInvocation

$elements = Resolve-RepositoryElements -BoundParameters $PSBoundParameters -DisableValidation
$elements = Resolve-RepositoryElements -BoundParameters $PSBoundParameters
$OwnerName = $elements.ownerName
$RepositoryName = $elements.repositoryName

$telemetryProperties = @{}

$telemetryProperties['OwnerName'] = Get-PiiSafeString -PlainText $OwnerName
$telemetryProperties['RepositoryName'] = Get-PiiSafeString -PlainText $RepositoryName
$telemetryProperties = @{
'OwnerName' = (Get-PiiSafeString -PlainText $OwnerName)
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
}

$uriFragment = "repos/$OwnerName/$RepositoryName/releases"
$description = "Getting releases for $OwnerName/$RepositoryName"
Expand Down Expand Up @@ -854,13 +854,7 @@ function New-GitHubReleaseAsset

Write-InvocationLog

$elements = Resolve-RepositoryElements -DisableValidation
$OwnerName = $elements.ownerName
$RepositoryName = $elements.repositoryName

$telemetryProperties = @{
'OwnerName' = (Get-PiiSafeString -PlainText $OwnerName)
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
'ProvidedUploadUrl' = (-not [String]::IsNullOrWhiteSpace($UploadUrl))
'ProvidedLabel' = (-not [String]::IsNullOrWhiteSpace($Label))
'ProvidedContentType' = (-not [String]::IsNullOrWhiteSpace($ContentType))
Expand All @@ -869,8 +863,15 @@ function New-GitHubReleaseAsset
# If UploadUrl wasn't provided, we'll need to query for it first.
if ($PSCmdlet.ParameterSetName -in ('Elements', 'Uri'))
{
$info = Get-GitHubRelease -OwnerName $OwnerName -RepositoryName $RepositoryName -Release $Release -AccessToken:$AccessToken -NoStatus:$NoStatus
$UploadUrl = $info.upload_url
$elements = Resolve-RepositoryElements
$OwnerName = $elements.ownerName
$RepositoryName = $elements.repositoryName

$telemetryProperties['OwnerName'] = (Get-PiiSafeString -PlainText $OwnerName)
$telemetryProperties['RepositoryName'] = (Get-PiiSafeString -PlainText $RepositoryName)

$releaseInfo = Get-GitHubRelease -OwnerName $OwnerName -RepositoryName $RepositoryName -Release $Release -AccessToken:$AccessToken -NoStatus:$NoStatus
$UploadUrl = $releaseInfo.upload_url
}

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

0 comments on commit 82d5455

Please sign in to comment.