Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions GitHubRepositories.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ filter New-GitHubRepository
.PARAMETER AllowAutoMerge
Specifies whether to allow auto-merge on pull requests.

.PARAMETER AllowUpdateBranch
Specifies whether to always allow a pull request head branch that is behind its base branch
to be updated even if it is not required to be up-to-date before merging.

.PARAMETER DeleteBranchOnMerge
Specifies the automatic deleting of head branches when pull requests are merged.

Expand Down Expand Up @@ -170,6 +174,8 @@ filter New-GitHubRepository

[switch] $AllowAutoMerge,

[switch] $AllowUpdateBranch,

[switch] $DeleteBranchOnMerge,

[switch] $IsTemplate,
Expand Down Expand Up @@ -217,6 +223,7 @@ filter New-GitHubRepository
if ($PSBoundParameters.ContainsKey('DisallowMergeCommit')) { $hashBody['allow_merge_commit'] = (-not $DisallowMergeCommit.ToBool()) }
if ($PSBoundParameters.ContainsKey('DisallowRebaseMerge')) { $hashBody['allow_rebase_merge'] = (-not $DisallowRebaseMerge.ToBool()) }
if ($PSBoundParameters.ContainsKey('AllowAutoMerge')) { $hashBody['allow_auto_merge'] = $AllowAutoMerge.ToBool() }
if ($PSBoundParameters.ContainsKey('AllowUpdateBranch')) { $hashBody['allow_update_branch'] = $AllowUpdateBranch.ToBool() }
if ($PSBoundParameters.ContainsKey('DeleteBranchOnMerge')) { $hashBody['delete_branch_on_merge'] = $DeleteBranchOnMerge.ToBool() }
if ($PSBoundParameters.ContainsKey('IsTemplate')) { $hashBody['is_template'] = $IsTemplate.ToBool() }

Expand Down Expand Up @@ -1075,6 +1082,10 @@ filter Set-GitHubRepository
.PARAMETER AllowAutoMerge
Specifies whether to allow auto-merge on pull requests.

.PARAMETER AllowUpdateBranch
Specifies whether to always allow a pull request head branch that is behind its base branch
to be updated even if it is not required to be up-to-date before merging.

.PARAMETER DeleteBranchOnMerge
Specifies the automatic deleting of head branches when pull requests are merged.

Expand Down Expand Up @@ -1181,6 +1192,8 @@ filter Set-GitHubRepository

[switch] $AllowAutoMerge,

[switch] $AllowUpdateBranch,

[switch] $DeleteBranchOnMerge,

[switch] $IsTemplate,
Expand Down Expand Up @@ -1227,6 +1240,7 @@ filter Set-GitHubRepository
if ($PSBoundParameters.ContainsKey('DisallowMergeCommit')) { $hashBody['allow_merge_commit'] = (-not $DisallowMergeCommit.ToBool()) }
if ($PSBoundParameters.ContainsKey('DisallowRebaseMerge')) { $hashBody['allow_rebase_merge'] = (-not $DisallowRebaseMerge.ToBool()) }
if ($PSBoundParameters.ContainsKey('AllowAutoMerge')) { $hashBody['allow_auto_merge'] = $AllowAutoMerge.ToBool() }
if ($PSBoundParameters.ContainsKey('AllowUpdateBranch')) { $hashBody['allow_update_branch'] = $AllowUpdateBranch.ToBool() }
if ($PSBoundParameters.ContainsKey('DeleteBranchOnMerge')) { $hashBody['delete_branch_on_merge'] = $DeleteBranchOnMerge.ToBool() }
if ($PSBoundParameters.ContainsKey('IsTemplate')) { $hashBody['is_template'] = $IsTemplate.ToBool() }
if ($PSBoundParameters.ContainsKey('Archived')) { $hashBody['archived'] = $Archived.ToBool() }
Expand Down
4 changes: 4 additions & 0 deletions Tests/GitHubRepositories.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Describe 'GitHubRepositories\New-GitHubRepository' {
DisallowMergeCommit = $true
DisallowRebaseMerge = $false
AllowAutoMerge = $true
AllowUpdateBranch = $true
DeleteBranchOnMerge = $true
GitIgnoreTemplate = $testGitIgnoreTemplate
LicenseTemplate = $testLicenseTemplate
Expand All @@ -148,6 +149,7 @@ Describe 'GitHubRepositories\New-GitHubRepository' {
$repo.allow_merge_commit | Should -BeFalse
$repo.allow_rebase_merge | Should -BeTrue
$repo.allow_auto_merge | Should -BeTrue
$repo.allow_update_branch | Should -BeTrue
$repo.delete_branch_on_merge | Should -BeTrue
$repo.is_template | Should -BeTrue
}
Expand Down Expand Up @@ -780,6 +782,7 @@ Describe 'GitHubRepositories\Set-GitHubRepository' {
DisallowSquashMerge = $true
DisallowMergeCommit = $true
DisallowRebaseMerge = $false
AllowUpdateBranch = $true
DeleteBranchOnMerge = $true
IsTemplate = $true
}
Expand All @@ -803,6 +806,7 @@ Describe 'GitHubRepositories\Set-GitHubRepository' {
$updatedRepo.allow_squash_merge | Should -BeFalse
$updatedRepo.allow_merge_commit | Should -BeFalse
$updatedRepo.allow_rebase_merge | Should -BeTrue
$updatedRepo.allow_update_branch | Should -BeTrue
$updatedRepo.delete_branch_on_merge | Should -BeTrue
$updatedRepo.is_template | Should -BeTrue
}
Expand Down