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
Changes from 10 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
43 changes: 41 additions & 2 deletions GitHubRepositories.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ 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 Visibility
Specifies the visibility level of the repository.

.PARAMETER NoIssues
By default, this repository will support Issues. Specify this to disable Issues.

Expand All @@ -69,6 +72,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 @@ -106,6 +115,9 @@ function New-GitHubRepository

[switch] $Private,

[ValidateSet('Public', 'Private', 'Internal')]
[string] $Visibility,
X-Guardian marked this conversation as resolved.
Show resolved Hide resolved

[switch] $NoIssues,

[switch] $NoProjects,
Expand All @@ -120,6 +132,10 @@ function New-GitHubRepository

[switch] $DisallowRebaseMerge,

[switch] $DeleteBranchOnMerge,

[switch] $IsTemplate,

[string] $AccessToken,

[switch] $NoStatus
Expand Down Expand Up @@ -156,19 +172,23 @@ function New-GitHubRepository
if ($PSBoundParameters.ContainsKey('LicenseTemplate')) { $hashBody['license_template'] = $LicenseTemplate }
if ($PSBoundParameters.ContainsKey('TeamId')) { $hashBody['team_id'] = $TeamId }
if ($PSBoundParameters.ContainsKey('Private')) { $hashBody['private'] = $Private.ToBool() }
if ($PSBoundParameters.ContainsKey('Visibility')) { $hashBody['visibility'] = $Visibility }
X-Guardian marked this conversation as resolved.
Show resolved Hide resolved
if ($PSBoundParameters.ContainsKey('NoIssues')) { $hashBody['has_issues'] = (-not $NoIssues.ToBool()) }
if ($PSBoundParameters.ContainsKey('NoProjects')) { $hashBody['has_projects'] = (-not $NoProjects.ToBool()) }
if ($PSBoundParameters.ContainsKey('NoWiki')) { $hashBody['has_wiki'] = (-not $NoWiki.ToBool()) }
if ($PSBoundParameters.ContainsKey('AutoInit')) { $hashBody['auto_init'] = $AutoInit.ToBool() }
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:nebulaAcceptHeader,$script:baptisteAcceptHeader"
'Description' = "Creating $RepositoryName"
'AccessToken' = $AccessToken
'TelemetryEventName' = $MyInvocation.MyCommand.Name
'TelemetryProperties' = $telemetryProperties
Expand Down Expand Up @@ -720,6 +740,9 @@ function Update-GitHubRepository
Specify this to make the repository private.
To change a repository to be public, specify -Private:$false

.PARAMETER Visibility
Specifies the visibility level of the repository.

.PARAMETER NoIssues
By default, this repository will support Issues. Specify this to disable Issues.

Expand All @@ -743,6 +766,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 Down Expand Up @@ -787,6 +816,9 @@ function Update-GitHubRepository

[switch] $Private,

[ValidateSet('Public', 'Private', 'Internal')]
[string] $Visibility,

[switch] $NoIssues,

[switch] $NoProjects,
Expand All @@ -799,6 +831,10 @@ function Update-GitHubRepository

[switch] $DisallowRebaseMerge,

[switch] $DeleteBranchOnMerge,

[switch] $IsTemplate,

[switch] $Archived,

[string] $AccessToken,
Expand All @@ -825,12 +861,15 @@ function Update-GitHubRepository
if ($PSBoundParameters.ContainsKey('Homepage')) { $hashBody['homepage'] = $Homepage }
if ($PSBoundParameters.ContainsKey('DefaultBranch')) { $hashBody['default_branch'] = $DefaultBranch }
if ($PSBoundParameters.ContainsKey('Private')) { $hashBody['private'] = $Private.ToBool() }
if ($PSBoundParameters.ContainsKey('Visibility')) { $hashBody['visibility'] = $Visibility }
if ($PSBoundParameters.ContainsKey('NoIssues')) { $hashBody['has_issues'] = (-not $NoIssues.ToBool()) }
if ($PSBoundParameters.ContainsKey('NoProjects')) { $hashBody['has_projects'] = (-not $NoProjects.ToBool()) }
if ($PSBoundParameters.ContainsKey('NoWiki')) { $hashBody['has_wiki'] = (-not $NoWiki.ToBool()) }
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 = @{
Expand Down