variables
Creates, updates, deletes, gets or lists a variables resource.
Overview
| Name | variables |
| Type | Resource |
| Id | github.actions.variables |
Fields
The following fields are returned by SELECT queries:
- get_environment_variable
- get_repo_variable
- list_environment_variables
- get_org_variable
- list_repo_variables
- list_org_variables
Response
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the variable. (example: USERNAME) |
created_at | string (date-time) | The date and time at which the variable was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. (example: 2019-01-24T22:45:36.000Z) |
updated_at | string (date-time) | The date and time at which the variable was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. (example: 2019-01-24T22:45:36.000Z) |
value | string | The value of the variable. (example: octocat) |
Response
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the variable. (example: USERNAME) |
created_at | string (date-time) | The date and time at which the variable was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. (example: 2019-01-24T22:45:36.000Z) |
updated_at | string (date-time) | The date and time at which the variable was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. (example: 2019-01-24T22:45:36.000Z) |
value | string | The value of the variable. (example: octocat) |
Response
| Name | Datatype | Description |
|---|---|---|
total_count | integer | |
variables | array |
Response
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the variable. (example: USERNAME) |
created_at | string (date-time) | The date and time at which the variable was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. (example: 2019-01-24T22:45:36.000Z) |
selected_repositories_url | string (uri) | (example: https://api.github.com/organizations/org/variables/USERNAME/repositories) |
updated_at | string (date-time) | The date and time at which the variable was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. (example: 2019-01-24T22:45:36.000Z) |
value | string | The value of the variable. (example: octocat) |
visibility | string | Visibility of a variable (all, private, selected) |
Response
| Name | Datatype | Description |
|---|---|---|
total_count | integer | |
variables | array |
Response
| Name | Datatype | Description |
|---|---|---|
total_count | integer | |
variables | array |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_environment_variable | select | owner, repo, environment_name, name | Gets a specific variable in an environment. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint. | |
get_repo_variable | select | owner, repo, name | Gets a specific variable in a repository. 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_variables | select | owner, repo, environment_name | per_page, page | Lists all environment variables. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. |
get_org_variable | select | org, name | Gets a specific variable in an organization. The authenticated user must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the admin: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_variables | select | owner, repo | per_page, page | Lists all repository variables. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. |
list_org_variables | select | org | per_page, page | Lists all organization variables. Authenticated users must have collaborator access to a repository to create, update, or read variables. 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_environment_variable | insert | owner, repo, environment_name, name, value | Create an environment variable that you can reference in a GitHub Actions workflow. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint. | |
create_repo_variable | insert | owner, repo, name, value | Creates a repository variable that you can reference in a GitHub Actions workflow. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint. | |
create_org_variable | insert | org, name, value, visibility | Creates an organization variable that you can reference in a GitHub Actions workflow. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the admin: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. | |
update_environment_variable | update | owner, repo, name, environment_name | Updates an environment variable that you can reference in a GitHub Actions workflow. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. | |
update_repo_variable | update | owner, repo, name | Updates a repository variable that you can reference in a GitHub Actions workflow. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. | |
update_org_variable | update | org, name | Updates an organization variable that you can reference in a GitHub Actions workflow. Authenticated users must have collaborator access to a repository to create, update, or read variables. 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. | |
delete_environment_variable | delete | owner, repo, name, environment_name | Deletes an environment variable using the variable name. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint. | |
delete_repo_variable | delete | owner, repo, name | Deletes a repository variable using the variable name. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint. | |
delete_org_variable | delete | org, name | Deletes an organization variable using the variable name. Authenticated users must have collaborator access to a repository to create, update, or read variables. OAuth tokens and personal access tokens (classic) need the admin: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.
| Name | Datatype | Description |
|---|---|---|
environment_name | string | The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F. |
name | string | The name of the variable. |
org | string | The organization name. The name is not case sensitive. |
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. |
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 30). For more information, see "Using pagination in the REST API." |
SELECT examples
- get_environment_variable
- get_repo_variable
- list_environment_variables
- get_org_variable
- list_repo_variables
- list_org_variables
Gets a specific variable in an environment.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
SELECT
name,
created_at,
updated_at,
value
FROM github.actions.variables
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND environment_name = '{{ environment_name }}' -- required
AND name = '{{ name }}' -- required
;
Gets a specific variable in a repository.
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.
SELECT
name,
created_at,
updated_at,
value
FROM github.actions.variables
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND name = '{{ name }}' -- required
;
Lists all environment variables.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
SELECT
total_count,
variables
FROM github.actions.variables
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND environment_name = '{{ environment_name }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
Gets a specific variable in an organization.
The authenticated user must have collaborator access to a repository to create, update, or read variables.
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.
SELECT
name,
created_at,
selected_repositories_url,
updated_at,
value,
visibility
FROM github.actions.variables
WHERE org = '{{ org }}' -- required
AND name = '{{ name }}' -- required
;
Lists all repository variables.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
SELECT
total_count,
variables
FROM github.actions.variables
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
Lists all organization variables.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
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.
SELECT
total_count,
variables
FROM github.actions.variables
WHERE org = '{{ org }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create_environment_variable
- create_repo_variable
- create_org_variable
- Manifest
Create an environment variable that you can reference in a GitHub Actions workflow.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
INSERT INTO github.actions.variables (
name,
value,
owner,
repo,
environment_name
)
SELECT
'{{ name }}' /* required */,
'{{ value }}' /* required */,
'{{ owner }}',
'{{ repo }}',
'{{ environment_name }}'
;
Creates a repository variable that you can reference in a GitHub Actions workflow.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
INSERT INTO github.actions.variables (
name,
value,
owner,
repo
)
SELECT
'{{ name }}' /* required */,
'{{ value }}' /* required */,
'{{ owner }}',
'{{ repo }}'
;
Creates an organization variable that you can reference in a GitHub Actions workflow.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
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.
INSERT INTO github.actions.variables (
name,
value,
visibility,
selected_repository_ids,
org
)
SELECT
'{{ name }}' /* required */,
'{{ value }}' /* required */,
'{{ visibility }}' /* required */,
'{{ selected_repository_ids }}',
'{{ org }}'
;
# Description fields are for documentation purposes
- name: variables
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the variables resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the variables resource.
- name: environment_name
value: "{{ environment_name }}"
description: Required parameter for the variables resource.
- name: org
value: "{{ org }}"
description: Required parameter for the variables resource.
- name: name
value: "{{ name }}"
description: |
The name of the variable.
- name: value
value: "{{ value }}"
description: |
The value of the variable.
- name: visibility
value: "{{ visibility }}"
description: |
The type of repositories in the organization that can access the variable. `selected` means only the repositories specified by `selected_repository_ids` can access the variable.
valid_values: ['all', 'private', 'selected']
- name: selected_repository_ids
value:
- {{ selected_repository_ids }}
description: |
An array of repository ids that can access the organization variable. You can only provide a list of repository ids when the `visibility` is set to `selected`.
UPDATE examples
- update_environment_variable
- update_repo_variable
- update_org_variable
Updates an environment variable that you can reference in a GitHub Actions workflow.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
UPDATE github.actions.variables
SET
name = '{{ name }}',
value = '{{ value }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND name = '{{ name }}' --required
AND environment_name = '{{ environment_name }}' --required;
Updates a repository variable that you can reference in a GitHub Actions workflow.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
UPDATE github.actions.variables
SET
name = '{{ name }}',
value = '{{ value }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND name = '{{ name }}' --required;
Updates an organization variable that you can reference in a GitHub Actions workflow.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
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.
UPDATE github.actions.variables
SET
name = '{{ name }}',
value = '{{ value }}',
visibility = '{{ visibility }}',
selected_repository_ids = '{{ selected_repository_ids }}'
WHERE
org = '{{ org }}' --required
AND name = '{{ name }}' --required;
DELETE examples
- delete_environment_variable
- delete_repo_variable
- delete_org_variable
Deletes an environment variable using the variable name.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
DELETE FROM github.actions.variables
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND name = '{{ name }}' --required
AND environment_name = '{{ environment_name }}' --required
;
Deletes a repository variable using the variable name.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
DELETE FROM github.actions.variables
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND name = '{{ name }}' --required
;
Deletes an organization variable using the variable name.
Authenticated users must have collaborator access to a repository to create, update, or read variables.
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 FROM github.actions.variables
WHERE org = '{{ org }}' --required
AND name = '{{ name }}' --required
;