Skip to content

Commit 77fe711

Browse files
lol768a-lwilliams
lol768
authored andcommitted
Add documentation for deployments API
1 parent 5d94a88 commit 77fe711

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

doc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ APIs:
1818
* [Contents](repo/contents.md)
1919
* [Releases](repo/releases.md)
2020
* [Assets](repo/assets.md)
21+
* [Deployments](repo/deployments.md)
2122
* [Users](users.md)
2223
* [Meta](meta.md)
2324
* [Activity](activity.md)

doc/repo/deployments.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Repo / Deployments API
2+
[Back to the "Repos API"](../repos.md) | [Back to the navigation](../index.md)
3+
4+
Provides information about deployments for a repository. Wraps [GitHub Deployments API](https://developer.github.com/v3/repos/deployments/).
5+
6+
#### List all deployments.
7+
8+
```php
9+
$deployments = $client->api('deployment')->all('KnpLabs', 'php-github-api');
10+
```
11+
12+
You can also filter the returned results (see [the documentation](https://developer.github.com/v3/repos/deployments/#list-deployments) for more information):
13+
14+
```php
15+
$deployments = $client->api('deployment')->all('KnpLabs', 'php-github-api', array('environment' => 'production'));
16+
```
17+
18+
#### Create a new deployments.
19+
20+
The `ref` parameter is required.
21+
22+
```php
23+
$data = $client->api('deployment')->create('KnpLabs', 'php-github-api', array('ref' => 'fd6a5f9e5a430dddae8d6a8ea378f913d3a766f9'));
24+
```
25+
26+
Please note that once a deployment is created it cannot be edited. Only status updates can be created.
27+
28+
#### Create a new status update.
29+
30+
The `state` parameter is required. At the time of writing, this must be pending, success, error, or failure.
31+
32+
```php
33+
$data = $client->api('deployment')->updateStatus('KnpLabs', 'php-github-api', 1, array('state' => 'error', 'description' => 'syntax error'));
34+
```
35+
36+
#### Get all status updates for a deployment.
37+
38+
```php
39+
$statusUpdates = $client->api('deployment')->getStatuses('KnpLabs', 'php-github-api', 1);
40+
```

0 commit comments

Comments
 (0)