Skip to main content

team_access_restrictions

Creates, updates, deletes, gets or lists a team_access_restrictions resource.

Overview

Nameteam_access_restrictions
TypeResource
Idgithub.repos.team_access_restrictions

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger
namestring
enterprise_idintegerUnique identifier of the enterprise to which this team belongs
node_idstring
organization_idintegerUnique identifier of the organization to which this team belongs
descriptionstring
html_urlstring (uri) (example: https://github.com/orgs/rails/teams/core)
members_urlstring
notification_settingstring
parentobjectGroups of organization members that gives permissions on specified repositories. (title: Team Simple)
permissionstring
permissionsobject
privacystring
repositories_urlstring (uri)
slugstring
typestringThe ownership type of the team (enterprise, organization)
urlstring (uri)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_teams_with_access_to_protected_branchselectowner, repo, branchProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Lists the teams who have push access to this branch. The list includes child teams.
add_team_access_restrictionsinsertowner, repo, branch, teamsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Grants the specified teams push access for this branch. You can also give push access to child teams.
set_team_access_restrictionsreplaceowner, repo, branch, teamsProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Replaces the list of teams that have push access to this branch. This removes all teams that previously had push access and grants push access to the new list of teams. Team restrictions include child teams.
remove_team_access_restrictionsdeleteowner, repo, branchProtected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Removes the ability of a team to push to this branch. You can also remove push access for child teams.

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
branchstringThe name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.

SELECT examples

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Lists the teams who have push access to this branch. The list includes child teams.

SELECT
id,
name,
enterprise_id,
node_id,
organization_id,
description,
html_url,
members_url,
notification_setting,
parent,
permission,
permissions,
privacy,
repositories_url,
slug,
type,
url
FROM github.repos.team_access_restrictions
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND branch = '{{ branch }}' -- required
;

INSERT examples

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Grants the specified teams push access for this branch. You can also give push access to child teams.

INSERT INTO github.repos.team_access_restrictions (
teams,
owner,
repo,
branch
)
SELECT
'{{ teams }}' /* required */,
'{{ owner }}',
'{{ repo }}',
'{{ branch }}'
RETURNING
id,
name,
enterprise_id,
node_id,
organization_id,
description,
html_url,
members_url,
notification_setting,
parent,
permission,
permissions,
privacy,
repositories_url,
slug,
type,
url
;

REPLACE examples

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Replaces the list of teams that have push access to this branch. This removes all teams that previously had push access and grants push access to the new list of teams. Team restrictions include child teams.

REPLACE github.repos.team_access_restrictions
SET
teams = '{{ teams }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND branch = '{{ branch }}' --required
AND teams = '{{ teams }}' --required
RETURNING
id,
name,
enterprise_id,
node_id,
organization_id,
description,
html_url,
members_url,
notification_setting,
parent,
permission,
permissions,
privacy,
repositories_url,
slug,
type,
url;

DELETE examples

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Removes the ability of a team to push to this branch. You can also remove push access for child teams.

DELETE FROM github.repos.team_access_restrictions
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND branch = '{{ branch }}' --required
;