|
| 1 | +## Organization / Variables API |
| 2 | +[Back to the "Organization API"](../organization.md) | [Back to the navigation](../README.md) |
| 3 | + |
| 4 | +### List organization variables |
| 5 | + |
| 6 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-organization-variables |
| 7 | + |
| 8 | +```php |
| 9 | +$variables = $client->organization()->variables()->all('KnpLabs'); |
| 10 | +``` |
| 11 | + |
| 12 | +### Get an organization variable |
| 13 | + |
| 14 | +https://docs.github.com/en/rest/reference/actions#get-an-organization-secret |
| 15 | + |
| 16 | +```php |
| 17 | +$variable = $client->organization()->variables()->show('KnpLabs', $variableName); |
| 18 | +``` |
| 19 | + |
| 20 | +### Create an organization variable |
| 21 | + |
| 22 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#create-an-organization-variable |
| 23 | + |
| 24 | +```php |
| 25 | +$client->organization()->variables()->create('KnpLabs', [ |
| 26 | + 'name' => $name, |
| 27 | + 'value' => $value, |
| 28 | + 'visibility' => $visibility, |
| 29 | + 'selected_repository_ids' => $selectedRepositoryIds, |
| 30 | +]); |
| 31 | +``` |
| 32 | + |
| 33 | +### Update an organization variable |
| 34 | + |
| 35 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#update-an-organization-variable |
| 36 | + |
| 37 | +```php |
| 38 | +$client->organization()->variables()->update('KnpLabs', $variableName, [ |
| 39 | + 'name' => $name, |
| 40 | + 'value' => $value, |
| 41 | + 'visibility' => $visibility, |
| 42 | + 'selected_repository_ids' => $selectedRepositoryIds |
| 43 | +]); |
| 44 | +``` |
| 45 | + |
| 46 | +### Delete an organization variable |
| 47 | + |
| 48 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#delete-an-organization-variable |
| 49 | + |
| 50 | +```php |
| 51 | +$client->organization()->variables()->remove('KnpLabs', $variableName); |
| 52 | +``` |
| 53 | + |
| 54 | +### List selected repositories for organization variable |
| 55 | + |
| 56 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-variable |
| 57 | + |
| 58 | +```php |
| 59 | +$client->organization()->variables()->selectedRepositories('KnpLabs', $variableName); |
| 60 | +``` |
| 61 | + |
| 62 | +### Set selected repositories for an organization variable |
| 63 | + |
| 64 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-variable |
| 65 | + |
| 66 | +```php |
| 67 | +$client->organization()->variables()->setSelectedRepositories('KnpLabs', 'variableName', [ |
| 68 | + 'selected_repository_ids' => [1, 2, 3], |
| 69 | +]); |
| 70 | +``` |
| 71 | + |
| 72 | +### Add selected repository to an organization variable |
| 73 | + |
| 74 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#add-selected-repository-to-an-organization-variable |
| 75 | + |
| 76 | +```php |
| 77 | +$client->organization()->variables()->addRepository('KnpLabs', $repositoryId, $variableName); |
| 78 | +``` |
| 79 | + |
| 80 | +### Remove selected repository from an organization variable |
| 81 | + |
| 82 | +https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-variable |
| 83 | + |
| 84 | +```php |
| 85 | +$client->organization()->variables()->removeRepository('KnpLabs', $repositoryId, $variableName); |
| 86 | +``` |
| 87 | + |
0 commit comments