Skip to main content

user_secrets

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

Overview

Nameuser_secrets
TypeResource
Idgithub.codespaces.user_secrets

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
repositoriesarray
total_countinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_repositories_for_secret_for_authenticated_userselectsecret_nameList the repositories that have been granted the ability to use a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.
add_repository_for_secret_for_authenticated_userinsertsecret_name, repository_idAdds a repository to the selected repositories for a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.
set_repositories_for_secret_for_authenticated_userreplacesecret_name, selected_repository_idsSelect the repositories that will use a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.
remove_repository_for_secret_for_authenticated_userdeletesecret_name, repository_idRemoves a repository from the selected repositories for a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.

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

SELECT examples

List the repositories that have been granted the ability to use a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.

SELECT
repositories,
total_count
FROM github.codespaces.user_secrets
WHERE secret_name = '{{ secret_name }}' -- required
;

INSERT examples

Adds a repository to the selected repositories for a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.

INSERT INTO github.codespaces.user_secrets (
secret_name,
repository_id
)
SELECT
'{{ secret_name }}',
'{{ repository_id }}'
;

REPLACE examples

Select the repositories that will use a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.

REPLACE github.codespaces.user_secrets
SET
selected_repository_ids = '{{ selected_repository_ids }}'
WHERE
secret_name = '{{ secret_name }}' --required
AND selected_repository_ids = '{{ selected_repository_ids }}' --required;

DELETE examples

Removes a repository from the selected repositories for a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the codespace or codespace:secrets scope to use this endpoint.

DELETE FROM github.codespaces.user_secrets
WHERE secret_name = '{{ secret_name }}' --required
AND repository_id = '{{ repository_id }}' --required
;