Skip to content

Commit 6a211e1

Browse files
bobeaganNyholm
authored andcommitted
add basic branch protection docs (#569)
* add basic branch protection docs * example params for branch protection
1 parent 717bfa8 commit 6a211e1

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

doc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ APIs:
3232
* [Repositories](repos.md)
3333
* [Contents](repo/contents.md)
3434
* [Deployments](repo/deployments.md)
35+
* [Protection](repo/protection.md)
3536
* [Releases](repo/releases.md)
3637
* [Assets](repo/assets.md)
3738
* [Stargazers](repo/stargazers.md)

doc/repo/protection.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Repo / Protection API
2+
[Back to the "Repos API"](../repos.md) | [Back to the navigation](../README.md)
3+
4+
The Protection API is currently available for developers to preview.
5+
To access the API during the preview period, you must provide a custom media type in the Accept header:
6+
7+
```php
8+
$client->api('repo')->protection()->configure();
9+
```
10+
11+
### List all branch protection
12+
13+
> Requires [authentication](../security.md).
14+
15+
```php
16+
$protection = $client->api('repo')->protection()->show('twbs', 'bootstrap', 'master');
17+
```
18+
19+
### Update branch protection
20+
21+
> Requires [authentication](../security.md).
22+
23+
For the full list of parameters see https://developer.github.com/v3/repos/branches/#parameters-1
24+
25+
```php
26+
$params = [
27+
'required_status_checks' => null,
28+
'required_pull_request_reviews' => [
29+
'include_admins' => true,
30+
],
31+
'enforce_admins' => true,
32+
'restrictions' => null,
33+
];
34+
$protection = $client->api('repo')->protection()->show('twbs', 'bootstrap', 'master', $params);
35+
```

0 commit comments

Comments
 (0)