API changes to support internal repository visibility
Customers with an enterprise account using GitHub Enterprise Cloud 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 Edit 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 Edit 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. In the REST v3 API, you will see the following changes:
These endpoints show visibility key in the response:
- List your repositories
- List user repositories
- List organization repositories
- Create repository
- Create repository using a repository template
- Get a repository
- Edit repository
These endpoints have new input parameters:
-
Create repository has a new
visibilityfield which can bepublic,private, orinternal. A value provided here overrides any value set in the existingprivatefield. -
Edit repository also has a new
visibilityfield with the same behavior as the Create 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.