app_access_restrictions
Creates, updates, deletes, gets or lists an app_access_restrictions resource.
Overview
| Name | app_access_restrictions |
| Type | Resource |
| Id | github.repos.app_access_restrictions |
Fields
The following fields are returned by SELECT queries:
- get_apps_with_access_to_protected_branch
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | Unique identifier of the GitHub app |
name | string | The name of the GitHub app (example: Probot Owners) |
client_id | string | (example: "Iv1.25b5d1e65ffc4022") |
node_id | string | (example: MDExOkludGVncmF0aW9uMQ==) |
created_at | string (date-time) | (example: 2017-07-08T16:18:44-04:00) |
description | string | (example: The description of the app.) |
events | array | The list of events for the GitHub app. Note that the installation_target, security_advisory, and meta events are not included because they are global events and not specific to an installation. |
external_url | string (uri) | (example: https://example.com) |
html_url | string (uri) | (example: https://github.com/apps/super-ci) |
installations_count | integer | The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself. |
owner | object | A GitHub user. (title: Simple User) |
permissions | object | The set of permissions for the GitHub app |
slug | string | The slug name of the GitHub app (example: probot-owners) |
updated_at | string (date-time) | (example: 2017-07-08T16:18:44-04:00) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_apps_with_access_to_protected_branch | select | owner, repo, branch | 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 GitHub Apps that have push access to this branch. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch. | |
add_app_access_restrictions | insert | owner, repo, branch, apps | 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 apps push access for this branch. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch. | |
set_app_access_restrictions | replace | owner, repo, branch, apps | 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 apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch. | |
remove_app_access_restrictions | delete | owner, repo, branch | 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 an app to push to this branch. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch. |
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.
| Name | Datatype | Description |
|---|---|---|
branch | string | The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API. |
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
SELECT examples
- get_apps_with_access_to_protected_branch
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 GitHub Apps that have push access to this branch. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch.
SELECT
id,
name,
client_id,
node_id,
created_at,
description,
events,
external_url,
html_url,
installations_count,
owner,
permissions,
slug,
updated_at
FROM github.repos.app_access_restrictions
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND branch = '{{ branch }}' -- required
;
INSERT examples
- add_app_access_restrictions
- Manifest
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 apps push access for this branch. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch.
INSERT INTO github.repos.app_access_restrictions (
apps,
owner,
repo,
branch
)
SELECT
'{{ apps }}' /* required */,
'{{ owner }}',
'{{ repo }}',
'{{ branch }}'
RETURNING
id,
name,
client_id,
node_id,
created_at,
description,
events,
external_url,
html_url,
installations_count,
owner,
permissions,
slug,
updated_at
;
# Description fields are for documentation purposes
- name: app_access_restrictions
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the app_access_restrictions resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the app_access_restrictions resource.
- name: branch
value: "{{ branch }}"
description: Required parameter for the app_access_restrictions resource.
- name: apps
value:
- "{{ apps }}"
description: |
The GitHub Apps that have push access to this branch. Use the slugified version of the app name. **Note**: The list of users, apps, and teams in total is limited to 100 items.
REPLACE examples
- set_app_access_restrictions
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 apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch.
REPLACE github.repos.app_access_restrictions
SET
apps = '{{ apps }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND branch = '{{ branch }}' --required
AND apps = '{{ apps }}' --required
RETURNING
id,
name,
client_id,
node_id,
created_at,
description,
events,
external_url,
html_url,
installations_count,
owner,
permissions,
slug,
updated_at;
DELETE examples
- remove_app_access_restrictions
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 an app to push to this branch. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch.
DELETE FROM github.repos.app_access_restrictions
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND branch = '{{ branch }}' --required
;