Skip to content

Commit 59ba94c

Browse files
committed
add method to remove branch protection and doc example
1 parent f7be4c5 commit 59ba94c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

doc/repo/protection.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@ $params = [
3333
];
3434
$protection = $client->api('repo')->protection()->show('twbs', 'bootstrap', 'master', $params);
3535
```
36+
37+
### Remove branch protection
38+
39+
> Requires [authentication](../security.md).
40+
41+
```php
42+
$protection = $client->api('repo')->protection()->remove('twbs', 'bootstrap', 'master');
43+
```

lib/Github/Api/Repository/Protection.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,18 @@ public function update($username, $repository, $branch, array $params = array())
5252
{
5353
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection', $params);
5454
}
55+
56+
/**
57+
* Remove the repo's branch protection
58+
*
59+
* @link https://developer.github.com/v3/repos/branches/#remove-branch-protection
60+
*
61+
* @param string $username The user who owns the repository
62+
* @param string $repository The name of the repo
63+
* @param string $branch The name of the branch
64+
*/
65+
public function remove($username, $repository, $branch)
66+
{
67+
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
68+
}
5569
}

0 commit comments

Comments
 (0)