API changes to support internal repository visibility
Customers with an enterprise account using GitHub Enterprise Cloud and GitHub Enterprise Server 2.20+ have access to a third visibility option beyond public and private, called internal. We've made some recent API changes to support this option.
Repository Creation Policy
The REST v3 and GraphQL v4 APIs now support setting and retrieving granular repository creation permissions.
REST v3 API
In the REST v3 API, Get an organization
and Update an organization endpoints have three
new fields added to the existing surtur preview:
members_can_create_public_repositoriesmembers_can_create_private_repositoriesmembers_can_create_internal_repositories
In Get an organization and Update an organization, the existing members_allowed_repository_creation_type field remains for backward compatibility but is deprecated and will be removed in the future. Its return value ignores internal repositories.
Values provided in the new fields while editing an organization override the existing members_allowed_repository_creation_type field.
GraphL v4 API
Similar changes apply to the GraphQL v4 API. The EnterpriseOwnerInfo object has three new fields indicating the policy setting for Enterprise accounts:
membersCanCreatePublicRepositoriesSettingmembersCanCreatePrivateRepositoriesSettingmembersCanCreateInternalRepositoriesSetting
These new fields coexist with the old membersCanCreateRepositoriesSetting which does not account for internal repository creation policy. This field is now deprecated and will be removed in the future.
The UpdateEnterpriseMembersCanCreateRepositoriesSetting mutation includes four new input fields:
-
membersCanCreateRepositoriesPolicyEnabled, which toggles enterprise policy enforcement over organizations. membersCanCreatePublicRepositoriesmembersCanCreatePrivateRepositoriesmembersCanCreateInternalRepositories
These new fields coexist with the old settingValue which does not account for internal repository creation policy. This field is also deprecated and will be removed in the future.
Repository Visibility Fields
You can now set and retrieve the visibility of a repository with a new field that accommodates internal repositories, which are available to enterprise accounts using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. In the REST v3 API, you will see the following changes:
These endpoints show visibility key in the response:
- List repositories for the authenticated user
- List repositories for a user
- List organization repositories
- Create a repository for the authenticated user
- Create a repository using a template
- Get a repository
- Update a repository
These endpoints have new input parameters:
-
Create a repository for the authenticated user has a new
visibilityfield which can bepublic,private, orinternal. A value provided here overrides any value set in the existingprivatefield. -
Update a repository also has a new
visibilityfield with the same behavior as the Create a repository for the authenticated user endpoint. -
List organization repositories has a new
internalinput option for thetypeparameter.
To access the visibility field for any of these endpoints, you must provide a custom media type in the Accept header:
application/vnd.github.nebula-preview+json
If you have any questions or feedback, please let us know.