variables.md
March 10, 2023 ยท View on GitHub
Organization / Variables API
Back to the "Organization API" | Back to the navigation
List organization variables
https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-organization-variables
$variables = $client->organization()->variables()->all('KnpLabs');
Get an organization variable
https://docs.github.com/en/rest/reference/actions#get-an-organization-secret
$variable = $client->organization()->variables()->show('KnpLabs', $variableName);
Create an organization variable
$client->organization()->variables()->create('KnpLabs', [
'name' => $name,
'value' => $value,
'visibility' => $visibility,
'selected_repository_ids' => $selectedRepositoryIds,
]);
Update an organization variable
$client->organization()->variables()->update('KnpLabs', $variableName, [
'name' => $name,
'value' => $value,
'visibility' => $visibility,
'selected_repository_ids' => $selectedRepositoryIds
]);
Delete an organization variable
$client->organization()->variables()->remove('KnpLabs', $variableName);
List selected repositories for organization variable
$client->organization()->variables()->selectedRepositories('KnpLabs', $variableName);
Set selected repositories for an organization variable
$client->organization()->variables()->setSelectedRepositories('KnpLabs', 'variableName', [
'selected_repository_ids' => [1, 2, 3],
]);
Add selected repository to an organization variable
$client->organization()->variables()->addRepository('KnpLabs', $repositoryId, $variableName);
Remove selected repository from an organization variable
$client->organization()->variables()->removeRepository('KnpLabs', $repositoryId, $variableName);