Skip to main content

secrets

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

Overview

Namesecrets
TypeResource
Idgithub.actions.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_environment_secretselectowner, repo, environment_name, secret_nameGets a single environment secret without revealing its encrypted value.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
get_repo_secretselectowner, repo, secret_nameGets a single repository secret without revealing its encrypted value.

The authenticated user must have collaborator access to the repository to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
list_environment_secretsselectowner, repo, environment_nameper_page, pageLists all secrets available in an environment without revealing their
encrypted values.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
get_org_secretselectorg, secret_nameGets a single organization secret without revealing its encrypted value.

The authenticated user must have collaborator access to a repository to create, update, or read secrets

OAuth tokens and personal access tokens (classic) need theadmin:org scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
list_repo_secretsselectowner, repoper_page, pageLists all secrets available in a repository without revealing their encrypted
values.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
list_org_secretsselectorgper_page, pageLists all secrets available in an organization without revealing their
encrypted values.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. If the repository is private, the repo scope is also required.
create_or_update_environment_secretinsertowner, repo, environment_name, secret_name, encrypted_value, key_idCreates or updates an environment secret with an encrypted value. Encrypt your secret using
LibSodium. For more information, see "Encrypting secrets for the REST API."

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

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

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
create_or_update_org_secretinsertorg, secret_name, encrypted_value, key_id, visibilityCreates or updates an organization secret with an encrypted value. Encrypt your secret using
LibSodium. For more information, see "Encrypting secrets for the REST API."

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth tokens and personal access tokens (classic) need theadmin:org scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
delete_environment_secretdeleteowner, repo, environment_name, secret_nameDeletes a secret in an environment using the secret name.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
delete_repo_secretdeleteowner, repo, secret_nameDeletes a secret in a repository using the secret name.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
delete_org_secretdeleteorg, secret_nameDeletes a secret in an organization using the secret name.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

OAuth tokens and personal access tokens (classic) need theadmin:org scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the repo 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
environment_namestringThe name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
orgstringThe organization name. The name is not case sensitive.
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 environment secret without revealing its encrypted value.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

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

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

INSERT examples

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

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

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

INSERT INTO github.actions.secrets (
encrypted_value,
key_id,
owner,
repo,
environment_name,
secret_name
)
SELECT
'{{ encrypted_value }}' /* required */,
'{{ key_id }}' /* required */,
'{{ owner }}',
'{{ repo }}',
'{{ environment_name }}',
'{{ secret_name }}'
;

DELETE examples

Deletes a secret in an environment using the secret name.

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

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

DELETE FROM github.actions.secrets
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND environment_name = '{{ environment_name }}' --required
AND secret_name = '{{ secret_name }}' --required
;