deploy_keys
Creates, updates, deletes, gets or lists a deploy_keys resource.
Overview
| Name | deploy_keys |
| Type | Resource |
| Id | github.repos.deploy_keys |
Fields
The following fields are returned by SELECT queries:
- get_deploy_key
- list_deploy_keys
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
added_by | string | |
created_at | string | |
enabled | boolean | |
key | string | |
last_used | string (date-time) | |
read_only | boolean | |
title | string | |
url | string | |
verified | boolean |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
added_by | string | |
created_at | string | |
enabled | boolean | |
key | string | |
last_used | string (date-time) | |
read_only | boolean | |
title | string | |
url | string | |
verified | boolean |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_deploy_key | select | owner, repo, key_id | ||
list_deploy_keys | select | owner, repo | per_page, page | |
create_deploy_key | insert | owner, repo, key | You can create a read-only deploy key. | |
delete_deploy_key | delete | owner, repo, key_id | Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead. |
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 |
|---|---|---|
key_id | integer | The unique identifier of the key. |
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. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
SELECT examples
- get_deploy_key
- list_deploy_keys
Response
SELECT
id,
added_by,
created_at,
enabled,
key,
last_used,
read_only,
title,
url,
verified
FROM github.repos.deploy_keys
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND key_id = '{{ key_id }}' -- required
;
Response
SELECT
id,
added_by,
created_at,
enabled,
key,
last_used,
read_only,
title,
url,
verified
FROM github.repos.deploy_keys
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create_deploy_key
- Manifest
You can create a read-only deploy key.
INSERT INTO github.repos.deploy_keys (
title,
key,
read_only,
owner,
repo
)
SELECT
'{{ title }}',
'{{ key }}' /* required */,
{{ read_only }},
'{{ owner }}',
'{{ repo }}'
RETURNING
id,
added_by,
created_at,
enabled,
key,
last_used,
read_only,
title,
url,
verified
;
# Description fields are for documentation purposes
- name: deploy_keys
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the deploy_keys resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the deploy_keys resource.
- name: title
value: "{{ title }}"
description: |
A name for the key.
- name: key
value: "{{ key }}"
description: |
The contents of the key.
- name: read_only
value: {{ read_only }}
description: |
If `true`, the key will only be able to read repository contents. Otherwise, the key will be able to read and write.
Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "[Repository permission levels for an organization](https://docs.github.com/articles/repository-permission-levels-for-an-organization/)" and "[Permission levels for a user account repository](https://docs.github.com/articles/permission-levels-for-a-user-account-repository/)."
DELETE examples
- delete_deploy_key
Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.
DELETE FROM github.repos.deploy_keys
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND key_id = '{{ key_id }}' --required
;