Skip to main content

deploy_keys

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

Overview

Namedeploy_keys
TypeResource
Idgithub.repos.deploy_keys

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger
added_bystring
created_atstring
enabledboolean
keystring
last_usedstring (date-time)
read_onlyboolean
titlestring
urlstring
verifiedboolean

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_deploy_keyselectowner, repo, key_id
list_deploy_keysselectowner, repoper_page, page
create_deploy_keyinsertowner, repo, keyYou can create a read-only deploy key.
delete_deploy_keydeleteowner, repo, key_idDeploy 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.

NameDatatypeDescription
key_idintegerThe unique identifier of the key.
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.
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

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
;

INSERT examples

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
;

DELETE examples

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
;