New/Set-GitHubRepository: Add AllowAutoMerge and UseSquashPrTitleAsDefault Parameters (#358)
Adds the following parameters to the `New-GitHubRepository` and `Set-GitHubRepository` functions: * AllowAutoMerge * UseSquashPrTitleAsDefault References * https://docs.github.com/en/rest/repos/repos#create-an-organization-repository * https://docs.github.com/en/rest/repos/repos#update-a-repository Fixes #357
This commit is contained in:
Родитель
d8ee50a7ad
Коммит
1afe5ac872
|
@ -83,6 +83,13 @@ filter New-GitHubRepository
|
|||
By default, rebase-merge pull requests will be allowed.
|
||||
Specify this to disallow.
|
||||
|
||||
.PARAMETER AllowAutoMerge
|
||||
Specifies whether to allow auto-merge on pull requests.
|
||||
|
||||
.PARAMETER UseSquashPrTitleAsDefault
|
||||
Specifies whether to use the pull request title for squash-merge commits rather than the
|
||||
commit message.
|
||||
|
||||
.PARAMETER DeleteBranchOnMerge
|
||||
Specifies the automatic deleting of head branches when pull requests are merged.
|
||||
|
||||
|
@ -160,6 +167,10 @@ filter New-GitHubRepository
|
|||
|
||||
[switch] $DisallowRebaseMerge,
|
||||
|
||||
[switch] $AllowAutoMerge,
|
||||
|
||||
[switch] $UseSquashPrTitleAsDefault,
|
||||
|
||||
[switch] $DeleteBranchOnMerge,
|
||||
|
||||
[switch] $IsTemplate,
|
||||
|
@ -205,6 +216,8 @@ filter New-GitHubRepository
|
|||
if ($PSBoundParameters.ContainsKey('DisallowSquashMerge')) { $hashBody['allow_squash_merge'] = (-not $DisallowSquashMerge.ToBool()) }
|
||||
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('UseSquashPrTitleAsDefault')) { $hashBody['use_squash_pr_title_as_default'] = $UseSquashPrTitleAsDefault.ToBool() }
|
||||
if ($PSBoundParameters.ContainsKey('DeleteBranchOnMerge')) { $hashBody['delete_branch_on_merge'] = $DeleteBranchOnMerge.ToBool() }
|
||||
if ($PSBoundParameters.ContainsKey('IsTemplate')) { $hashBody['is_template'] = $IsTemplate.ToBool() }
|
||||
|
||||
|
@ -1057,6 +1070,13 @@ filter Set-GitHubRepository
|
|||
By default, rebase-merge pull requests will be allowed.
|
||||
Specify this to disallow.
|
||||
|
||||
.PARAMETER AllowAutoMerge
|
||||
Specifies whether to allow auto-merge on pull requests.
|
||||
|
||||
.PARAMETER UseSquashPrTitleAsDefault
|
||||
Specifies whether to use the pull request title for squash-merge commits rather than the
|
||||
commit message.
|
||||
|
||||
.PARAMETER DeleteBranchOnMerge
|
||||
Specifies the automatic deleting of head branches when pull requests are merged.
|
||||
|
||||
|
@ -1159,6 +1179,10 @@ filter Set-GitHubRepository
|
|||
|
||||
[switch] $DisallowRebaseMerge,
|
||||
|
||||
[switch] $AllowAutoMerge,
|
||||
|
||||
[switch] $UseSquashPrTitleAsDefault,
|
||||
|
||||
[switch] $DeleteBranchOnMerge,
|
||||
|
||||
[switch] $IsTemplate,
|
||||
|
@ -1203,6 +1227,8 @@ filter Set-GitHubRepository
|
|||
if ($PSBoundParameters.ContainsKey('DisallowSquashMerge')) { $hashBody['allow_squash_merge'] = (-not $DisallowSquashMerge.ToBool()) }
|
||||
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('UseSquashPrTitleAsDefault')) { $hashBody['use_squash_pr_title_as_default'] = $UseSquashPrTitleAsDefault.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() }
|
||||
|
|
|
@ -119,6 +119,8 @@ try
|
|||
DisallowSquashMerge = $true
|
||||
DisallowMergeCommit = $true
|
||||
DisallowRebaseMerge = $false
|
||||
AllowAutoMerge = $true
|
||||
UseSquashPrTitleAsDefault = $true
|
||||
DeleteBranchOnMerge = $true
|
||||
GitIgnoreTemplate = $testGitIgnoreTemplate
|
||||
LicenseTemplate = $testLicenseTemplate
|
||||
|
@ -142,6 +144,8 @@ try
|
|||
$repo.allow_squash_merge | Should -BeFalse
|
||||
$repo.allow_merge_commit | Should -BeFalse
|
||||
$repo.allow_rebase_merge | Should -BeTrue
|
||||
$repo.allow_auto_merge | Should -BeTrue
|
||||
$repo.use_squash_pr_title_as_default | Should -BeTrue
|
||||
$repo.delete_branch_on_merge | Should -BeTrue
|
||||
$repo.is_template | Should -BeTrue
|
||||
}
|
||||
|
@ -170,6 +174,8 @@ try
|
|||
DisallowSquashMerge = $true
|
||||
DisallowMergeCommit = $false
|
||||
DisallowRebaseMerge = $true
|
||||
AllowAutoMerge = $false
|
||||
UseSquashPrTitleAsDefault = $false
|
||||
}
|
||||
$repo = New-GitHubRepository @newGitHubRepositoryParms
|
||||
}
|
||||
|
@ -183,6 +189,8 @@ try
|
|||
$repo.allow_squash_merge | Should -BeFalse
|
||||
$repo.allow_merge_commit | Should -BeTrue
|
||||
$repo.allow_rebase_merge | Should -BeFalse
|
||||
$repo.allow_auto_merge | Should -BeFalse
|
||||
$repo.use_squash_pr_title_as_default | Should -BeFalse
|
||||
}
|
||||
|
||||
AfterAll -ScriptBlock {
|
||||
|
@ -729,6 +737,8 @@ try
|
|||
DisallowMergeCommit = $true
|
||||
DisallowRebaseMerge = $false
|
||||
DeleteBranchOnMerge = $true
|
||||
AllowAutoMerge = $true
|
||||
UseSquashPrTitleAsDefault = $true
|
||||
IsTemplate = $true
|
||||
}
|
||||
|
||||
|
@ -750,6 +760,8 @@ try
|
|||
$updatedRepo.allow_squash_merge | Should -BeFalse
|
||||
$updatedRepo.allow_merge_commit | Should -BeFalse
|
||||
$updatedRepo.allow_rebase_merge | Should -BeTrue
|
||||
$updatedRepo.allow_auto_merge | Should -BeTrue
|
||||
$updatedRepo.use_squash_pr_title_as_default | Should -BeTrue
|
||||
$updatedRepo.delete_branch_on_merge | Should -BeTrue
|
||||
$updatedRepo.is_template | Should -BeTrue
|
||||
}
|
||||
|
@ -763,6 +775,8 @@ try
|
|||
DisallowSquashMerge = $true
|
||||
DisallowMergeCommit = $false
|
||||
DisallowRebaseMerge = $true
|
||||
AllowAutoMerge = $false
|
||||
UseSquashPrTitleAsDefault = $false
|
||||
}
|
||||
|
||||
$updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms -PassThru
|
||||
|
@ -777,6 +791,8 @@ try
|
|||
$updatedRepo.allow_squash_merge | Should -BeFalse
|
||||
$updatedRepo.allow_merge_commit | Should -BeTrue
|
||||
$updatedRepo.allow_rebase_merge | Should -BeFalse
|
||||
$updatedRepo.use_squash_pr_title_as_default | Should -BeFalse
|
||||
$updatedRepo.delete_branch_on_merge | Should -BeFalse
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче