Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHubRepositories: Add Additional Parameters #192

Merged
merged 20 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c67b279
Update GitHubRepositories.ps1
X-Guardian May 28, 2020
dfd95ca
Merge branch 'master' into GitHubRepository-Add-Properties
X-Guardian May 29, 2020
e5cc1fa
Merge branch 'master' into GitHubRepository-Add-Properties
X-Guardian May 29, 2020
738da43
Merge branch 'master' into GitHubRepository-Add-Properties
X-Guardian May 31, 2020
b2ee25d
Add Nebula/Baptiste Accept Header
X-Guardian May 31, 2020
0661a98
Merge branch 'GitHubRepository-Add-Properties' of https://github.com/…
X-Guardian May 31, 2020
b0026e4
Merge branch 'master' into GitHubRepository-Add-Properties
HowardWolosky May 31, 2020
aec7d0d
Merge branch 'master' into GitHubRepository-Add-Properties
HowardWolosky Jun 1, 2020
6e1e5de
Merge branch 'master' into GitHubRepository-Add-Properties
X-Guardian Jun 1, 2020
4bed23f
Merge branch 'master' into GitHubRepository-Add-Properties
HowardWolosky Jun 1, 2020
4c5b5c1
Review Updates
X-Guardian Jun 2, 2020
8787afd
Merge branch 'GitHubRepository-Add-Properties' of https://github.com/…
X-Guardian Jun 2, 2020
18a5235
Merge branch 'master' into GitHubRepository-Add-Properties
X-Guardian Jun 2, 2020
71e175c
Update review comments
X-Guardian Jun 2, 2020
d404247
Update GitHubRepositories.ps1
X-Guardian Jun 2, 2020
06b1cff
Merge branch 'master' into GitHubRepository-Add-Properties
X-Guardian Jun 2, 2020
b0711df
Add Update-GitHubRepository AcceptHeader
X-Guardian Jun 2, 2020
c2d60c0
Remove Visibility parameter
X-Guardian Jun 3, 2020
19020e5
Merge branch 'master' into GitHubRepository-Add-Properties
HowardWolosky Jun 4, 2020
5c0d45f
Update GitHubRepositories tests
X-Guardian Jun 4, 2020
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
34 changes: 32 additions & 2 deletions GitHubRepositories.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function New-GitHubRepository
This is only valid when creating a repository in an organization.

.PARAMETER Private
By default, this repository will created Public. Specify this to create
By default, this repository will be created Public. Specify this to create
a private repository.

.PARAMETER NoIssues
Expand Down Expand Up @@ -69,6 +69,12 @@ function New-GitHubRepository
By default, rebase-merge pull requests will be allowed.
Specify this to disallow.

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

.PARAMETER IsTemplate
Specifies whether the repository is made available as a template.

.PARAMETER AccessToken
If provided, this will be used as the AccessToken for authentication with the
REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.
Expand Down Expand Up @@ -120,6 +126,10 @@ function New-GitHubRepository

[switch] $DisallowRebaseMerge,

[switch] $DeleteBranchOnMerge,

[switch] $IsTemplate,

[string] $AccessToken,

[switch] $NoStatus
Expand Down Expand Up @@ -163,12 +173,15 @@ function 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('DeleteBranchOnMerge')) { $hashBody['delete_branch_on_merge'] = $DeleteBranchOnMerge.ToBool() }
if ($PSBoundParameters.ContainsKey('IsTemplate')) { $hashBody['is_template'] = $IsTemplate.ToBool() }

$params = @{
'UriFragment' = $uriFragment
'Body' = (ConvertTo-Json -InputObject $hashBody)
'Method' = 'Post'
'Description' = "Creating $RepositoryName"
'AcceptHeader' = $script:baptisteAcceptHeader
'Description' = "Creating $RepositoryName"
'AccessToken' = $AccessToken
'TelemetryEventName' = $MyInvocation.MyCommand.Name
'TelemetryProperties' = $telemetryProperties
Expand Down Expand Up @@ -743,6 +756,12 @@ function Update-GitHubRepository
By default, rebase-merge pull requests will be allowed.
Specify this to disallow.

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

.PARAMETER IsTemplate
Specifies whether the repository is made available as a template.

.PARAMETER Archived
Specify this to archive this repository.
NOTE: You cannot unarchive repositories through the API / this module.
Expand All @@ -760,8 +779,12 @@ function Update-GitHubRepository
.EXAMPLE
Update-GitHubRepository -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Description 'The best way to automate your GitHub interactions'

Changes the description of the specified repository.

.EXAMPLE
Update-GitHubRepository -Uri https://github.com/PowerShell/PowerShellForGitHub -Private:$false

Changes the visibility of the specified repository to be public.
#>
[CmdletBinding(
SupportsShouldProcess,
Expand Down Expand Up @@ -799,6 +822,10 @@ function Update-GitHubRepository

[switch] $DisallowRebaseMerge,

[switch] $DeleteBranchOnMerge,

[switch] $IsTemplate,

[switch] $Archived,

[string] $AccessToken,
Expand Down Expand Up @@ -831,12 +858,15 @@ function Update-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('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() }

$params = @{
'UriFragment' = "repos/$OwnerName/$RepositoryName"
'Body' = (ConvertTo-Json -InputObject $hashBody)
'Method' = 'Patch'
'AcceptHeader' = $script:baptisteAcceptHeader
'Description' = "Updating $RepositoryName"
'AccessToken' = $AccessToken
'TelemetryEventName' = $MyInvocation.MyCommand.Name
Expand Down
Loading