repository_secrets
Creates, updates, deletes, gets or lists a repository_secrets resource.
Overview
| Name | repository_secrets |
| Type | Resource |
| Id | github.codespaces.repository_secrets |
Fields
The following fields are returned by SELECT queries:
- get_repo_secret
- list_repo_secrets
Response
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the secret. (example: SECRET_TOKEN) |
created_at | string (date-time) | |
updated_at | string (date-time) |
Response
| Name | Datatype | Description |
|---|---|---|
secrets | array | |
total_count | integer |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_repo_secret | select | owner, repo, secret_name | 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. | |
list_repo_secrets | select | owner, repo | per_page, page | Lists 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_secret | insert | owner, repo, secret_name | 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. | |
delete_repo_secret | delete | owner, repo, secret_name | 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. |
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 |
|---|---|---|
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. |
secret_name | string | The name of the secret. |
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_repo_secret
- list_repo_secrets
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
;
Lists 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.
SELECT
secrets,
total_count
FROM github.codespaces.repository_secrets
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create_or_update_repo_secret
- Manifest
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 }}'
;
# Description fields are for documentation purposes
- name: repository_secrets
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the repository_secrets resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the repository_secrets resource.
- name: secret_name
value: "{{ secret_name }}"
description: Required parameter for the repository_secrets resource.
- name: encrypted_value
value: "{{ encrypted_value }}"
description: |
Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-public-key) endpoint.
- name: key_id
value: "{{ key_id }}"
description: |
ID of the key you used to encrypt the secret.
DELETE examples
- delete_repo_secret
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
;