Skip to main content

repos_for_org_variable

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

Overview

Namerepos_for_org_variable
TypeResource
Idgithub.actions.repos_for_org_variable

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_selected_repos_for_org_variableselectorg, namepage, per_pageLists all repositories that can access an organization variable
that is available to selected repositories.

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.
add_selected_repo_to_org_variableinsertorg, name, repository_idAdds a repository to an organization variable that is available to selected repositories.
Organization variables that are available to selected repositories have their visibility field set to selected.

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

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.
set_selected_repos_for_org_variablereplaceorg, name, selected_repository_idsReplaces all repositories for an organization variable that is available
to selected repositories. Organization variables that are available to selected
repositories have their visibility field set to selected.

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.
remove_selected_repo_from_org_variabledeleteorg, name, repository_idRemoves a repository from an organization variable that is
available to selected repositories. Organization variables that are available to
selected repositories have their visibility field set to selected.

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.

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
namestringThe name of the variable.
orgstringThe organization name. The name is not case sensitive.
repository_idinteger
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

Lists all repositories that can access an organization variable
that is available to selected repositories.

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
repositories,
total_count
FROM github.actions.repos_for_org_variable
WHERE org = '{{ org }}' -- required
AND name = '{{ name }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;

INSERT examples

Adds a repository to an organization variable that is available to selected repositories.
Organization variables that are available to selected repositories have their visibility field set to selected.

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

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.actions.repos_for_org_variable (
org,
name,
repository_id
)
SELECT
'{{ org }}',
'{{ name }}',
'{{ repository_id }}'
;

REPLACE examples

Replaces all repositories for an organization variable that is available
to selected repositories. Organization variables that are available to selected
repositories have their visibility field set to selected.

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.

REPLACE github.actions.repos_for_org_variable
SET
selected_repository_ids = '{{ selected_repository_ids }}'
WHERE
org = '{{ org }}' --required
AND name = '{{ name }}' --required
AND selected_repository_ids = '{{ selected_repository_ids }}' --required;

DELETE examples

Removes a repository from an organization variable that is
available to selected repositories. Organization variables that are available to
selected repositories have their visibility field set to selected.

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 FROM github.actions.repos_for_org_variable
WHERE org = '{{ org }}' --required
AND name = '{{ name }}' --required
AND repository_id = '{{ repository_id }}' --required
;