Skip to main content

installation_repos

Creates, updates, deletes, gets or lists an installation_repos resource.

Overview

Nameinstallation_repos
TypeResource
Idgithub.apps.installation_repos

Fields

The following fields are returned by SELECT queries:

The access the user has to each repository is included in the hash under the permissions key.

NameDatatypeDescription
repositoriesarray
repository_selectionstring
total_countinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_installation_repos_for_authenticated_userselectinstallation_idper_page, pageList repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access for an installation.

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

The access the user has to each repository is included in the hash under the permissions key.
list_repos_accessible_to_installationselectper_page, pageList repositories that an app installation can access.
add_repo_to_installation_for_authenticated_userinsertinstallation_id, repository_idAdd a single repository to an installation. The authenticated user must have admin access to the repository.

This endpoint only works for PATs (classic) with the repo scope.
remove_repo_from_installation_for_authenticated_userdeleteinstallation_id, repository_idRemove a single repository from an installation. The authenticated user must have admin access to the repository. The installation must have the repository_selection of selected.

This endpoint only works for PATs (classic) with the repo scope.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
installation_idintegerThe unique identifier of the installation.
repository_idintegerThe unique identifier of the repository.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

SELECT examples

List repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access for an installation.

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

The access the user has to each repository is included in the hash under the permissions key.

SELECT
repositories,
repository_selection,
total_count
FROM github.apps.installation_repos
WHERE installation_id = '{{ installation_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;

INSERT examples

Add a single repository to an installation. The authenticated user must have admin access to the repository.

This endpoint only works for PATs (classic) with the repo scope.

INSERT INTO github.apps.installation_repos (
installation_id,
repository_id
)
SELECT
'{{ installation_id }}',
'{{ repository_id }}'
;

DELETE examples

Remove a single repository from an installation. The authenticated user must have admin access to the repository. The installation must have the repository_selection of selected.

This endpoint only works for PATs (classic) with the repo scope.

DELETE FROM github.apps.installation_repos
WHERE installation_id = '{{ installation_id }}' --required
AND repository_id = '{{ repository_id }}' --required
;