Skip to content

Commit a869092

Browse files
committed
Fix review comments
1 parent 2940c54 commit a869092

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

GitHubBranches.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ filter Set-GitHubRepositoryBranchProtectionRule
421421

422422
[string[]] $RestrictPushApps,
423423

424-
[switch]$RequireLinearHistory,
424+
[switch] $RequireLinearHistory,
425425

426426
[switch] $AllowForcePushes,
427427

@@ -544,7 +544,8 @@ filter Set-GitHubRepositoryBranchProtectionRule
544544
$hashBody['allow_deletions'] = $AllowDeletions.ToBool()
545545
}
546546

547-
if ($PSCmdlet.ShouldProcess("'$BranchName' branch of repository '$RepositoryName'",
547+
if ($PSCmdlet.ShouldProcess(
548+
"'$BranchName' branch of repository '$RepositoryName'",
548549
'Set GitHub Repository Branch Protection'))
549550
{
550551
Write-InvocationLog
@@ -777,7 +778,7 @@ filter Add-GitHubBranchProtectionRuleAdditionalProperties
777778
[PSCustomObject[]] $InputObject,
778779

779780
[ValidateNotNullOrEmpty()]
780-
[string] $TypeName = $script:GitHubBranchTypeName
781+
[string] $TypeName = $script:GitHubBranchProtectionRuleName
781782
)
782783

783784
foreach ($item in $InputObject)
@@ -792,9 +793,9 @@ filter Add-GitHubBranchProtectionRuleAdditionalProperties
792793

793794
$hostName = $(Get-GitHubConfiguration -Name 'ApiHostName')
794795

795-
if ($item.html_url -match "^https?://api.$hostName/repos/([^/]+)/?([^/]+)/?([^/]+)/?([^/]+)?(?:/.*)?$")
796+
if ($item.html_url -match "^https?://(?:www\.|api\.|)$hostName/repos/(?:[^/]+)/(?:[^/]+)/branches/([^/]+)/.*$")
796797
{
797-
$branchName = $Matches[4]
798+
$branchName = $Matches[1]
798799
}
799800
else
800801
{

0 commit comments

Comments
 (0)