Skip to content

add missing protection methods, docs and tests #616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Change Log

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

## 2.6.0 (unreleased)

### Added

- Support for graphql api [variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) (#612)
- Added missing branch protection methods (#616)

## 2.5.0

Expand All @@ -25,15 +26,15 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee

### Added

- `Integrations::configure` to allow accessing early access program endpoints.
- `Integrations::configure` to allow accessing early access program endpoints.
- Add support for pagination and parameters in the pull request comments
- Add the ability to fetch user installations (`CurrentUser::installations`)
- Allow getting repo info by id (`Repo::showById`)
- Allow fetching repositories for a specific installation and user (`CurrentUser::repositoriesByInstallation`)

### Changed

- `PullRequest\Review` and `PullRequest\ReviewRequest` is now part of the official API. No need to call `configure`.
- `PullRequest\Review` and `PullRequest\ReviewRequest` is now part of the official API. No need to call `configure`.

## 2.3.0

Expand All @@ -49,18 +50,18 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee

### Changed

- First argument to `Integrations::listRepositories()` is now optional.
- First argument to `Integrations::listRepositories()` is now optional.
- Moved tests from "functional" to "integration"

## 2.2.0

### Added

- API support for Pull Request Review Requests.
- API support for Traffic.
- API support for issue Assignees.
- API support for Miscellaneous Gitignore and Emojis.
- Added endpoints for issue lock, unlock and issue label show.
- API support for Traffic.
- API support for issue Assignees.
- API support for Miscellaneous Gitignore and Emojis.
- Added endpoints for issue lock, unlock and issue label show.
- Added more parameters to `User::starred`.
- Fluid interface by allowing `configure()` to return `$this`.
- `configure()` support for issues API.
Expand All @@ -74,21 +75,21 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee

### Added

- Add support for retrieving a single notification info using his ID
- Add support for retrieving a single notification info using his ID
- Add a function to get user organizations
- Added GraphQL support
- Add page variable to organization repo list (Organization::repositories())
- Add support for pull request review.
- Add support for pull request review.
- Add support for adding branch protection.

### Fixed

- Bug with double slashes when using enterprise URL.
- Bug with double slashes when using enterprise URL.
- Bug when headers not being passed to request (#529)

## 2.0.0

### Added
### Added

- Support for JWT authentication
- API for Organization\Members
Expand All @@ -101,26 +102,26 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee

### Changed

- `ApiLimitExceedException::__construct` has a new second parameter for the remaining API calls.
- First parameter of `Github\Client` has changed type from `\Http\Client\HttpClient` to
`Github\HttpClient\Builder`. A factory class was also added. To upgrade you need to change:
- `ApiLimitExceedException::__construct` has a new second parameter for the remaining API calls.
- First parameter of `Github\Client` has changed type from `\Http\Client\HttpClient` to
`Github\HttpClient\Builder`. A factory class was also added. To upgrade you need to change:

```php
// Old way does not work:
$github = new Github\Client($httpClient);
$github = new Github\Client($httpClient);

// New way will work:
$github = new Github\Client(new Github\HttpClient\Builder($httpClient));
$github = Github\Client::createWithHttpClient($httpClient);
$github = new Github\Client(new Github\HttpClient\Builder($httpClient));
$github = Github\Client::createWithHttpClient($httpClient);
```
- Renamed the currentuser `DeployKeys` api class to `PublicKeys` to reflect to github api name.
- Renamed the currentuser `DeployKeys` api class to `PublicKeys` to reflect to github api name.

## 2.0.0-rc4

### Added
### Added

- HTTPlug to decouple from Guzzle
- `Github\Client::getLastResponse` was added
- `Github\Client::getLastResponse` was added
- Support for PSR-6 cache
- `Github\Client::addPlugin` and `Github\Client::removePlugin`
- `Github\Client::getApiVersion`
Expand All @@ -143,6 +144,6 @@ $github = Github\Client::createWithHttpClient($httpClient);
- `Github/HttpClient/CachedHttpClient` was removed
- All classes in `Github/HttpClient/Cache/*` were removed

## 1.7.1
## 1.7.1

No change log before this version
230 changes: 230 additions & 0 deletions doc/repo/protection.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,233 @@ $protection = $client->api('repo')->protection()->show('twbs', 'bootstrap', 'mas
```php
$protection = $client->api('repo')->protection()->remove('twbs', 'bootstrap', 'master');
```

### Get required status checks of protected branch

> Requires [authentication](../security.md).

```php
$protection = $client->api('repo')->protection()->showStatusChecks('twbs', 'bootstrap', 'master');
```

### Update required status checks of protected branch

> Requires [authentication](../security.md).

```php
$params = [
'strict' => true,
'contexts' => [
'continuous-integration/travis-ci',
],
];
$protection = $client->api('repo')->protection()->updateStatusChecks('twbs', 'bootstrap', 'master', $params);
```

### Remove required status checks of protected branch

> Requires [authentication](../security.md).

```php
$protection = $client->api('repo')->protection()->removeStatusChecks('twbs', 'bootstrap', 'master');
```

### List required status checks contexts of protected branch

> Requires [authentication](../security.md).

```php
$protection = $client->api('repo')->protection()->showStatusChecksContexts('twbs', 'bootstrap', 'master');
```

### Replace required status checks contexts of protected branch

> Requires [authentication](../security.md).

```php
$params = [
'continuous-integration/travis-ci',
];
$protection = $client->api('repo')->protection()->replaceStatusChecksContexts('twbs', 'bootstrap', 'master', $params);
```

### Add required status checks contexts of protected branch

> Requires [authentication](../security.md).

```php
$params = [
'continuous-integration/jenkins',
];
$protection = $client->api('repo')->protection()->addStatusChecksContexts('twbs', 'bootstrap', 'master', $params);
```

### Remove required status checks contexts of protected branch

> Requires [authentication](../security.md).

```php
$params = [
'continuous-integration/jenkins',
];
$protection = $client->api('repo')->protection()->removeStatusChecksContexts('twbs', 'bootstrap', 'master', $params);
```

### Get pull request review enforcement of protected branch

> Requires [authentication](../security.md).

```php
$protection = $client->api('repo')->protection()->showPullRequestReviewEnforcement('twbs', 'bootstrap', 'master');
```

### Update pull request review enforcement of protected branch

> Requires [authentication](../security.md) with admin access and branch protection to be enabled.

```php
$params = [
'dismissal_restrictions' => [
'users' => [
'octocat',
],
'teams' => [
'justice-league',
],
],
'dismiss_stale_reviews' => true,
'require_code_owner_reviews' => true,
];
$protection = $client->api('repo')->protection()->updatePullRequestReviewEnforcement('twbs', 'bootstrap', 'master', $params);
```

### Remove pull request review enforcement of protected branch

> Requires [authentication](../security.md).

```php
$protection = $client->api('repo')->protection()->removePullRequestReviewEnforcement('twbs', 'bootstrap', 'master');
```

### Get admin enforcement of protected branch


> Requires [authentication](../security.md).

```php
$protection = $client->api('repo')->protection()->showAdminEnforcement('twbs', 'bootstrap', 'master');
```

### Add admin enforcement of protected branch

> Requires [authentication](../security.md) with admin access and branch protection to be enabled.

```php
$protection = $client->api('repo')->protection()->addAdminEnforcement('twbs', 'bootstrap', 'master');
```

### Remove admin enforcement of protected branch

> Requires [authentication](../security.md) with admin access and branch protection to be enabled.

```php
$protection = $client->api('repo')->protection()->removeAdminEnforcement('twbs', 'bootstrap', 'master');
```

### Get restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$protection = $client->api('repo')->protection()->showRestrictions('twbs', 'bootstrap', 'master');
```

### Remove restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$protection = $client->api('repo')->protection()->removeRestrictions('twbs', 'bootstrap', 'master');
```

### List team restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$protection = $client->api('repo')->protection()->showTeamRestrictions('twbs', 'bootstrap', 'master');
```

### Replace team restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$params = [
'justice-league',
];
$protection = $client->api('repo')->protection()->replaceTeamRestrictions('twbs', 'bootstrap', 'master', $params);
```

### Add team restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$params = [
'justice-league',
];
$protection = $client->api('repo')->protection()->addTeamRestrictions('twbs', 'bootstrap', 'master', $params);
```

### Remove team restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$params = [
'octocats',
];
$protection = $client->api('repo')->protection()->removeTeamRestrictions('twbs', 'bootstrap', 'master', $params);
```

### List user restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$protection = $client->api('repo')->protection()->showUserRestrictions('twbs', 'bootstrap', 'master');
```

### Replace user restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$params = [
'octocat',
];
$protection = $client->api('repo')->protection()->replaceUserRestrictions('twbs', 'bootstrap', 'master', $params);
```

### Add user restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$params = [
'octocat',
];
$protection = $client->api('repo')->protection()->addUserRestrictions('twbs', 'bootstrap', 'master', $params);
```

### Remove user restrictions of protected branch

> Requires [authentication](../security.md) and is only available for organization-owned repositories.

```php
$params = [
'defunkt',
];
$protection = $client->api('repo')->protection()->removeUserRestrictions('twbs', 'bootstrap', 'master', $params);
```
Loading