Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
haridarshan authored Mar 10, 2023
2 parents 70e7bbe + c68b874 commit 50a0ee1
Show file tree
Hide file tree
Showing 28 changed files with 1,535 additions and 40 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG-3.X.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 3.11.0

### Added
- Added environment variables & secrets ([Froxz](https://github.com/Froxz)) [#1104](https://github.com/KnpLabs/php-github-api/issues/1104)
- Added Org & Repository variables ([Froxz](https://github.com/Froxz)) [#1106](https://github.com/KnpLabs/php-github-api/issues/1106)
- Deployment branch policies ([Froxz](https://github.com/Froxz)) [#1108](https://github.com/KnpLabs/php-github-api/issues/1108)

### Changed
- Test on PHP 8.2 ([GrahamCampbell](https://github.com/GrahamCampbell)) [#1105](https://github.com/KnpLabs/php-github-api/issues/1105)

### Fixed
- Bugfix creating env ([Froxz](https://github.com/Froxz)) [#1107](https://github.com/KnpLabs/php-github-api/issues/1107)

## 3.10.0

### Added
Expand Down
11 changes: 8 additions & 3 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ v3 APIs:
* [Organization](organization.md)
* [Members](organization/members.md)
* [Teams](organization/teams.md)
* Actions
* [Self hosted runners](organization/actions/self_hosted_runners.md)
* [Self hosted runners](organization/actions/self_hosted_runners.md)
* [Secrets](organization/actions/secrets.md)
* [Variables](organization/actions/variables.md)
* [Projects](project/projects.md)
* [Columns](project/columns.md)
* [Cards](project/cards.md)
Expand All @@ -53,6 +54,7 @@ v3 APIs:
* Actions
* [Artifacts](repo/actions/artifacts.md)
* [Secrets](repo/actions/secrets.md)
* [Variables](repo/actions/variables.md)
* [Self hosted runners](repo/actions/self_hosted_runners.md)
* [Workflow jobs](repo/actions/workflow_jobs.md)
* [Workflow runs](repo/actions/workflow_runs.md)
Expand All @@ -61,7 +63,10 @@ v3 APIs:
* [Check Suites](repo/check_suites.md)
* [Contents](repo/contents.md)
* [Deployments](repo/deployments.md)
* [Environments](repo/environments.md)
* [Policies](repo/deployments/policies.md)
* [Environments](repo/deployments/environments.md)
* [Secrets](repo/deployments/environment/secrets.md)
* [Variables](repo/deployments/environment/variables.md)
* [Labels](repo/labels.md)
* [Protection](repo/protection.md)
* [Releases](repo/releases.md)
Expand Down
87 changes: 87 additions & 0 deletions doc/organization/actions/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
## Organization / Variables API
[Back to the "Organization API"](../organization.md) | [Back to the navigation](../README.md)

### List organization variables

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-organization-variables

```php
$variables = $client->organization()->variables()->all('KnpLabs');
```

### Get an organization variable

https://docs.github.com/en/rest/reference/actions#get-an-organization-secret

```php
$variable = $client->organization()->variables()->show('KnpLabs', $variableName);
```

### Create an organization variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#create-an-organization-variable

```php
$client->organization()->variables()->create('KnpLabs', [
'name' => $name,
'value' => $value,
'visibility' => $visibility,
'selected_repository_ids' => $selectedRepositoryIds,
]);
```

### Update an organization variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#update-an-organization-variable

```php
$client->organization()->variables()->update('KnpLabs', $variableName, [
'name' => $name,
'value' => $value,
'visibility' => $visibility,
'selected_repository_ids' => $selectedRepositoryIds
]);
```

### Delete an organization variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#delete-an-organization-variable

```php
$client->organization()->variables()->remove('KnpLabs', $variableName);
```

### List selected repositories for organization variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-variable

```php
$client->organization()->variables()->selectedRepositories('KnpLabs', $variableName);
```

### Set selected repositories for an organization variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-variable

```php
$client->organization()->variables()->setSelectedRepositories('KnpLabs', 'variableName', [
'selected_repository_ids' => [1, 2, 3],
]);
```

### Add selected repository to an organization variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#add-selected-repository-to-an-organization-variable

```php
$client->organization()->variables()->addRepository('KnpLabs', $repositoryId, $variableName);
```

### Remove selected repository from an organization variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-variable

```php
$client->organization()->variables()->removeRepository('KnpLabs', $repositoryId, $variableName);
```

48 changes: 48 additions & 0 deletions doc/repo/actions/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Repo / Actions / Variables API
[Back to the "Repos API"](../../repos.md) | [Back to the navigation](../../README.md)

### List repository variables

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-repository-variables

```php
$variables = $client->api('repo')->variables()->all('KnpLabs', 'php-github-api');
```

### Get a repository variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#get-a-repository-variable

```php
$variable = $client->api('repo')->variables()->show('KnpLabs', 'php-github-api', $variableName);
```

### Create a repository variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#create-a-repository-variable

```php
$client->api('repo')->variables()->create('KnpLabs', 'php-github-api', [
'name' => $name,
'value' => $value,
]);
```

### Update a repository variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#update-a-repository-variable

```php
$client->api('repo')->variables()->update('KnpLabs', 'php-github-api', $variableName, [
'name' => $name,
'value' => $value,
]);
```

### Delete a repository variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#delete-a-repository-variable

```php
$client->api('repo')->variables()->remove('KnpLabs', 'php-github-api', $variableName);
```
46 changes: 46 additions & 0 deletions doc/repo/deployments/environment/secrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Environment / Secrets API
[Back to the "Environments API"](../environments.md) | [Back to the navigation](../README.md)

### List environment secrets

https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28

```php
$secrets = $client->environment()->secrets()->all($repoId, $envName);
```

### Get an environment secret

https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#get-an-environment-secret

```php
$secret = $client->environment()->secrets()->show($repoId, $envName, $secretName);
```

### Create or Update an environment secret

https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-environment-secret

```php
$client->environment()->secrets()->createOrUpdate($repoId, $envName, $secretName, [
'encrypted_value' => $encryptedValue,
'key_id' => $key_id
]);
```

### Delete an environment secret

https://docs.github.com/en/rest/reference/actions#delete-an-organization-secret

```php
$client->environment()->secrets()->remove($repoId, $envName, $secretName);
```

### Get an environment public key

https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key

```php
$client->environment()->secrets()->publicKey($repoId, $envName);
```

49 changes: 49 additions & 0 deletions doc/repo/deployments/environment/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Environment / Variables API
[Back to the "Environments API"](../environments.md) | [Back to the navigation](../README.md)

### List environment variables

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-environment-variables

```php
$variables = $client->environment()->variables()->all($repoId, $envName);
```

### Get an environment variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#get-an-environment-variable

```php
$variable = $client->environment()->variables()->show($repoId, $envName, $variableName);
```

### Create environment variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#create-an-environment-variable

```php
$client->environment()->variables()->create($repoId, $envName, [
'name' => $name,
'value' => $value
]);
```

### Update environment variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#update-an-environment-variable

```php
$client->environment()->variables()->update($repoId, $envName, $variableName, [
'name' => $name,
'value' => $value
]);
```

### Delete an environment variable

https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#delete-an-environment-variable

```php
$client->environment()->variables()->remove($repoId, $envName, $variableName);
```

32 changes: 32 additions & 0 deletions doc/repo/deployments/environments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Deployment / Environments API
[Back to the "Deployment API"](../deployments.md) | [Back to the navigation](../index.md)

Provides information about environments for a repository. Wraps [GitHub Environments API](https://docs.github.com/en/rest/deployments/environments?apiVersion=2022-11-28).

Additional APIs:
* [Secrets API](environment/secrets.md)
* [Variables API](environment/variables.md)

#### List all environments.

```php
$environments = $client->deployment()->environment()->all('KnpLabs', 'php-github-api');
```

### Get one environment.

```php
$environment = $client->deployment()->environment()->show('KnpLabs', 'php-github-api', $name);
```

#### Create or update environment.

```php
$data = $client->deployment()->environment()->createOrUpdate('KnpLabs', 'php-github-api', $name);
```

#### Delete a existing environment.

```php
$environment = $client->deployment()->environment()->remove('KnpLabs', 'php-github-api', $name);
```
38 changes: 38 additions & 0 deletions doc/repo/deployments/policies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Deployment / Branch policies API
[Back to the "Deployment API"](../deployments.md) | [Back to the navigation](../index.md)

Provides information about deployment branch policies. Wraps [GitHub Deployment branch policies API](https://docs.github.com/en/rest/deployments/branch-policies?apiVersion=2022-11-28#about-deployment-branch-policies).

#### List deployment branch policies.

```php
$policies = $client->deployment()->policies()->all('KnpLabs', 'php-github-api', 'production');
```

### Get one environment.

```php
$policy = $client->deployment()->policies()->show('KnpLabs', 'php-github-api', 'production', $branchPolicyId);
```

#### Create policy.

```php
$data = $client->deployment()->policies()->create('KnpLabs', 'php-github-api', 'production', [
'name' => 'name'
]);
```

#### Update policy.

```php
$data = $client->deployment()->policies()->update('KnpLabs', 'php-github-api', 'production', $branchPolicyId, [
'name' => 'name'
]);
```

#### Delete a existing policy.

```php
$policy = $client->deployment()->policies()->remove('KnpLabs', 'php-github-api', 'production', $branchPolicyId);
```
28 changes: 0 additions & 28 deletions doc/repo/environments.md

This file was deleted.

Loading

0 comments on commit 50a0ee1

Please sign in to comment.