Support `Internal` repos for GH Enterprise Cloud/Server
Feature Idea Summary
Support Visibility body parameter: https://docs.github.com/en/rest/repos/repos#create-an-organization-repository
Feature Idea Additional Details
Requested Assignment
- I'm just suggesting this idea, but don't want to implement it.
However, I have tested the change for New-GithubRepository
File: GitHubRepository.ps1
- Line 60: +
.PARAMETER Internal - Line 61: +
By default, this repository will be created Public. Specify this to create - Line 62: +
an internal repository (GH Enterprise Cloud/Server 2.20+ only). - Line 153: +
[switch] $Internal, - Line 207: +
if ($PSBoundParameters.ContainsKey('Internal')) { $hashBody['visibility'] = "internal" }
It works, but I know the above would have to be added to many other functions. I also don't know enough about Pester to submit a PR.
Operating System
OsName : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-GB
OsMuiLanguages : {en-GB}
PowerShell Version
Module Version
PS C:\> @(
>> "Running: $((Get-Module -Name PowerShellForGitHub) | Select-Object -ExpandProperty Version)",
>> "Installed: $((Get-Module -Name PowerShellForGitHub -ListAvailable) | Select-Object -ExpandProperty Version)"
>> ) -join [Environment]::NewLine
Populating RepositorySourceLocation property for module PowerShellForGitHub.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\Helpers.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubConfiguration.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubAnalytics.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubAssignees.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubBranches.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubCore.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubContents.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubEvents.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubGistComments.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubGists.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubIssueComments.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubIssues.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubLabels.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubMilestones.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubMiscellaneous.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubOrganizations.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubProjects.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubProjectCards.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubProjectColumns.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubPullRequests.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubReactions.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubReleases.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubRepositories.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubRepositoryForks.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubRepositoryTraffic.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubTeams.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubUsers.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\Telemetry.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\UpdateCheck.ps1'.
Loading module from path 'C:\Program Files\PowerShell\Modules\PowerShellForGitHub\0.16.1\PowerShellForGitHub.psm1'.
Running: 0.16.2
Installed: 0.16.1
Please note: I have bumped the version number in my testing.
Thanks.
This feature was started with #305 but was never completed.
@HowardWolosky,
Thanks for the reference. There's quite a lot involved! Although it does appear the docs have been updated to state visibility is for Enterprise organisations only:

I'll try and find time to run the organizations endpoint against my Enterprise organisation to see what I get for plan.name in the response.

https://docs.github.com/en/rest/orgs/orgs#get-an-organizationhttps://docs.github.com/en/rest/orgs/orgs#get-an-organization
Thanks.
That was easier than I thought:
PS C:\> $oReq = Invoke-GHRestMethod -UriFragment "orgs/{my-enterprise-org}/" -Method Get -Description "Get organisation"
PS C:\> $oReq.plan
name : enterprise
space : 976562499
private_repos : 999999
filled_seats : 2794
seats : 3000
Running the same thing against my own non-enterprise org:
PS C:\> $oReq = Invoke-GHRestMethod -UriFragment "orgs/{my-non-enterprise-org}/" -Method Get -Description "Get organisation"
PS C:\> $oReq.plan
name : free
space : 976562499
private_repos : 10000
filled_seats : 2
seats : 1
As plan.name returns enterprise and free, perhaps we can use this to determine the type of organisation. I guess we'd need a new function Get-GitHubOrganization too.
Thanks
Any plans to add this in?
Some organizations have Public repos disabled by default, so you could create repos as Private or Interal from the UI, but you can only do Private from the Github pwsh module.
It's then impossible to change the visibility of the repo through the Github module alone. Sure, you can go through the API directly, but it would have been a lot more helpful to have the Github module actually support this.