variables
Creates, updates, deletes, gets or lists a variables resource.
Overview
| Name | variables |
| Type | Resource |
| Id | github.agents.variables |
Fields
The following fields are returned by SELECT queries:
- get_repo_variable
- 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) |
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 |
|---|---|---|
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) |
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) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
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. | |
get_org_variable | select | org, name | Gets a specific agent 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 agent variables available in an organization. Returned variables include their values. 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_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 agent 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_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 agent 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_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 agent 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 |
|---|---|---|
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_repo_variable
- get_org_variable
- list_repo_variables
- list_org_variables
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.agents.variables
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND name = '{{ name }}' -- required
;
Gets a specific agent 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.
SELECT
name,
created_at,
selected_repositories_url,
updated_at,
value,
visibility
FROM github.agents.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
name,
created_at,
updated_at,
value
FROM github.agents.variables
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
Lists all agent variables available in an organization.
Returned variables include their values.
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
name,
created_at,
selected_repositories_url,
updated_at,
value,
visibility
FROM github.agents.variables
WHERE org = '{{ org }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create_repo_variable
- create_org_variable
- Manifest
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.agents.variables (
name,
value,
owner,
repo
)
SELECT
'{{ name }}' /* required */,
'{{ value }}' /* required */,
'{{ owner }}',
'{{ repo }}'
;
Creates an organization agent 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.
INSERT INTO github.agents.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: 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_repo_variable
- update_org_variable
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.agents.variables
SET
name = '{{ name }}',
value = '{{ value }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND name = '{{ name }}' --required;
Updates an organization agent 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.agents.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_repo_variable
- delete_org_variable
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.agents.variables
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND name = '{{ name }}' --required
;
Deletes an organization agent 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.
DELETE FROM github.agents.variables
WHERE org = '{{ org }}' --required
AND name = '{{ name }}' --required
;