Skip to main content

repository_secrets

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

Overview

Namerepository_secrets
TypeResource
Idgithub.codespaces.repository_secrets

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
namestringThe name of the secret. (example: SECRET_TOKEN)
created_atstring (date-time)
updated_atstring (date-time)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_repo_secretselectowner, repo, secret_nameGets a single repository development environment secret without revealing its encrypted value.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
list_repo_secretsselectowner, repoper_page, pageLists all development environment secrets available in a repository without revealing their encrypted
values.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
create_or_update_repo_secretinsertowner, repo, secret_nameCreates or updates a repository development environment secret with an encrypted value. Encrypt your secret using
LibSodium. For more information, see "Encrypting secrets for the REST API."

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. The associated user must be a repository admin.
delete_repo_secretdeleteowner, repo, secret_nameDeletes a development environment secret in a repository using the secret name.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. The associated user must be a repository admin.

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
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.
secret_namestringThe name of the secret.
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

Gets a single repository development environment secret without revealing its encrypted value.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

SELECT
name,
created_at,
updated_at
FROM github.codespaces.repository_secrets
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND secret_name = '{{ secret_name }}' -- required
;

INSERT examples

Creates or updates a repository development environment secret with an encrypted value. Encrypt your secret using
LibSodium. For more information, see "Encrypting secrets for the REST API."

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. The associated user must be a repository admin.

INSERT INTO github.codespaces.repository_secrets (
encrypted_value,
key_id,
owner,
repo,
secret_name
)
SELECT
'{{ encrypted_value }}',
'{{ key_id }}',
'{{ owner }}',
'{{ repo }}',
'{{ secret_name }}'
;

DELETE examples

Deletes a development environment secret in a repository using the secret name.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. The associated user must be a repository admin.

DELETE FROM github.codespaces.repository_secrets
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND secret_name = '{{ secret_name }}' --required
;