Skip to content

Commit 4e588d5

Browse files
committed
Merge branch '2.x'
* 2.x: Update apps.md Update branch alias after 2.17 release Update changelog for 2.17.0 release Improve github actions setup Improve checks api implementation Fix: Missing auth method in list of omitted passwords. Update branch-alias after 2.16.0 release Update changelog for 2.16.0 release
2 parents d28bf00 + df653f3 commit 4e588d5

File tree

15 files changed

+520
-8
lines changed

15 files changed

+520
-8
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ on:
55

66
jobs:
77
test:
8-
name: Test on ${{ matrix.php-versions }} PHP
8+
name: Test on PHP ${{ matrix.php-versions }}
99
runs-on: ubuntu-latest
1010

1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
php-versions: ['7.1', '7.2', '7.3', '7.4']
1415

@@ -19,13 +20,13 @@ jobs:
1920
uses: shivammathur/setup-php@v2
2021
with:
2122
php-version: ${{ matrix.php-versions }}
22-
coverage: xdebug
23+
coverage: none
2324

2425
- name: Install Composer Dependencies
2526
uses: ramsey/composer-install@v1
2627

2728
- name: Run phpunit
28-
run: vendor/bin/phpunit --verbose --coverage-text
29+
run: vendor/bin/phpunit --verbose
2930

3031
roave_bc_check:
3132
name: Roave BC Check
@@ -39,6 +40,7 @@ jobs:
3940
# uses: docker://nyholm/roave-bc-check-ga
4041

4142
phpstan:
43+
name: PHPStan
4244
runs-on: ubuntu-latest
4345

4446
steps:
@@ -47,6 +49,7 @@ jobs:
4749
- uses: shivammathur/setup-php@v2
4850
with:
4951
php-version: 7.1
52+
coverage: none
5053

5154
- name: Install Composer Dependencies
5255
uses: ramsey/composer-install@v1

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## 2.17.0
4+
5+
### Added
6+
7+
- Improve checks api implementation ([acrobat](https://github.com/acrobat)) [#932](https://github.com/KnpLabs/php-github-api/issues/932)
8+
9+
### Changed
10+
- Missing auth method in list of omitted passwords. ([tobyS](https://github.com/tobyS)) [#933](https://github.com/KnpLabs/php-github-api/issues/933)
11+
- Improve github actions setup ([acrobat](https://github.com/acrobat)) [#935](https://github.com/KnpLabs/php-github-api/issues/935)
12+
13+
## 2.16.0
14+
15+
### Added
16+
- Add support for SSO errors coming from the API ([eiriksm](https://github.com/eiriksm)) [#913](https://github.com/KnpLabs/php-github-api/issues/913)
17+
- Add OutsideCollaborators api ([Matth--](https://github.com/Matth--)) [#925](https://github.com/KnpLabs/php-github-api/issues/925)
18+
- Add support for creating a repo dispatch event ([Nyholm](https://github.com/Nyholm)) [#931](https://github.com/KnpLabs/php-github-api/issues/931)
19+
20+
### Changed
21+
- Fix: Wrong PHPDoc description ([OskarStark](https://github.com/OskarStark)) [#922](https://github.com/KnpLabs/php-github-api/issues/922)
22+
- Adding GitHub authentication to GraphQL documentation ([legionth](https://github.com/legionth)) [#927](https://github.com/KnpLabs/php-github-api/issues/927)
23+
24+
### Fixed
25+
- Use RFC3986 for building URI query strings ([GrahamCampbell](https://github.com/GrahamCampbell)) [#908](https://github.com/KnpLabs/php-github-api/issues/908)
26+
- Fix call to test a webhook method ([morrislaptop](https://github.com/morrislaptop)) [#915](https://github.com/KnpLabs/php-github-api/issues/915)
27+
328
## 2.15.0
429

530
### Added

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
"extra": {
4949
"branch-alias": {
50-
"dev-2.x": "2.15.x-dev",
50+
"dev-2.x": "2.17.x-dev",
5151
"dev-master": "3.0.x-dev"
5252
}
5353
}

doc/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ v3 APIs:
4848
* [Reviews](pull_request/reviews.md)
4949
* [Rate Limits](rate_limits.md)
5050
* [Repositories](repos.md)
51-
* [Checks](repo/checks.md)
51+
* [Check Runs](repo/check_runs.md)
52+
* [Check Suites](repo/check_suites.md)
5253
* [Contents](repo/contents.md)
5354
* [Deployments](repo/deployments.md)
5455
* [Labels](repo/labels.md)

doc/apps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $repositories = $client->api('apps')->listRepositories(456);
3636

3737
### List repositories for a given installation and user
3838

39-
```
39+
```php
4040
$repositories = $client->api('current_user')->repositoriesByInstallation(456);
4141
```
4242

doc/repo/check_runs.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
## Repo / Checks runs API
2+
[Back to the "Repos API"](../repos.md) | [Back to the navigation](../README.md)
3+
4+
### Create a check run
5+
6+
[Visit GitHub for a full of list of parameters and their descriptions.](https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#create-a-check-run)
7+
8+
```php
9+
$params = [
10+
'name' => 'my check', # required
11+
'head_sha' => $commitSha, # required
12+
'status' => 'queued',
13+
'output' => [/*...*/]
14+
];
15+
$check = $client->api('repo')->checkRuns()->create('KnpLabs', 'php-github-api', $params);
16+
```
17+
18+
### Get a check run
19+
20+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#get-a-check-run
21+
22+
```php
23+
$check = $client->api('repo')->checkRuns()->show('KnpLabs', 'php-github-api', $checkRunId);
24+
```
25+
26+
### Update an existing check run
27+
28+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-a-check-run
29+
30+
```php
31+
$params = [
32+
'name' => 'my check',
33+
'status' => 'in_progress',
34+
'output' => [/*...*/]
35+
];
36+
$check = $client->api('repo')->checkRuns()->update('KnpLabs', 'php-github-api', $checkRunId, $params);
37+
```
38+
39+
### List check run annotations
40+
41+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#list-check-run-annotations
42+
43+
```php
44+
$annotations = $client->api('repo')->checkRuns()->annotations('KnpLabs', 'php-github-api', $checkRunId);
45+
```
46+
47+
### List check runs for a check suite
48+
49+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#list-check-runs-in-a-check-suite
50+
51+
```php
52+
$params = [/*...*/];
53+
$checks = $client->api('repo')->checkRuns()->allForCheckSuite('KnpLabs', 'php-github-api', $checkSuiteId, $params);
54+
```
55+
56+
### List check runs for a Git reference
57+
58+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#list-check-runs-for-a-git-reference
59+
60+
```php
61+
$params = [/*...*/];
62+
$checks = $client->api('repo')->checkRuns()->allForReference('KnpLabs', 'php-github-api', $reference, $params);
63+
```
64+
65+
66+
67+

doc/repo/check_suites.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## Repo / Check suites API
2+
[Back to the "Repos API"](../repos.md) | [Back to the navigation](../README.md)
3+
4+
### Create a check suite
5+
6+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#create-a-check-suite
7+
8+
```php
9+
$params = [
10+
'head_sha' => $commitSha, # required
11+
];
12+
$check = $client->api('repo')->checkSuites()->create('KnpLabs', 'php-github-api', $params);
13+
```
14+
15+
### Update check suite preferences
16+
17+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-repository-preferences-for-check-suites
18+
19+
```php
20+
$params = [/*...*/];
21+
$check = $client->api('repo')->checkSuites()->updatePreferences('KnpLabs', 'php-github-api', $params);
22+
```
23+
24+
### Get a check suite
25+
26+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#get-a-check-suite
27+
28+
```php
29+
$check = $client->api('repo')->checkSuites()->getCheckSuite('KnpLabs', 'php-github-api', $checkSuiteId);
30+
```
31+
32+
### Rerequest a check suite
33+
34+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#rerequest-a-check-suite
35+
36+
```php
37+
$annotations = $client->api('repo')->checkSuites()->rerequest('KnpLabs', 'php-github-api', $checkSuiteId);
38+
```
39+
40+
41+
### List check suites for a Git reference
42+
43+
https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#list-check-suites-for-a-git-reference
44+
45+
```php
46+
$params = [/*...*/];
47+
$checks = $client->api('repo')->checkSuites()->allForReference('KnpLabs', 'php-github-api', $reference, $params);
48+
```

doc/repo/checks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Repo / Checks API
22
[Back to the "Repos API"](../repos.md) | [Back to the navigation](../README.md)
33

4+
**This API class is deprecated use the [Check runs](check_runs.md) and the [Check suites](check_suites.md) api classes.**
5+
46
### Create a check for a commit
57

68
[Visit GitHub for a full of list of parameters and their descriptions.](https://developer.github.com/v3/checks/runs/#create-a-check-run)

doc/security.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ and guess what should contain `$password`. The `$method` can contain one of the
2121
* `Github\Client::AUTH_ACCESS_TOKEN` - https://developer.github.com/v3/#oauth2-token-sent-in-a-header
2222
* `Github\Client::AUTH_JWT` - https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app
2323

24-
The required value of `$password` depends on the chosen `$method`. For `Github\Client::AUTH_ACCESS_TOKEN` and
24+
The required value of `$password` depends on the chosen `$method`. For `Github\Client::AUTH_ACCESS_TOKEN`, `Github\Client::AUTH_ACCESS_TOKEN` and
2525
`Github\Client::JWT` methods you should provide the API token in `$usernameOrToken` variable (`$password` is omitted in
2626
this particular case).
2727

lib/Github/Api/Repo.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Github\Api;
44

55
use Github\Api\Repository\Checks;
6+
use Github\Api\Repository\Checks\CheckRuns;
7+
use Github\Api\Repository\Checks\CheckSuites;
68
use Github\Api\Repository\Collaborators;
79
use Github\Api\Repository\Comments;
810
use Github\Api\Repository\Commits;
@@ -319,14 +321,33 @@ public function commits()
319321
* Manage checks on a repository.
320322
*
321323
* @link https://developer.github.com/v3/checks/
324+
* @deprecated since 2.17 and will be removed in 3.0. Use the "checkRuns" or "checkSuites" api's instead.
322325
*
323326
* @return Checks
324327
*/
325328
public function checks()
326329
{
330+
@trigger_error(sprintf('The "%s" is deprecated since knp-labs/php-github-api 2.17 and will be removed in knp-labs/php-github-api 3.0. Use the "checkRuns" or "checkSuites" api\'s instead.', __METHOD__), E_USER_DEPRECATED);
331+
327332
return new Checks($this->client);
328333
}
329334

335+
/**
336+
* @link https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#check-runs
337+
*/
338+
public function checkRuns(): CheckRuns
339+
{
340+
return new CheckRuns($this->client);
341+
}
342+
343+
/**
344+
* @link https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#check-suites
345+
*/
346+
public function checkSuites(): CheckSuites
347+
{
348+
return new CheckSuites($this->client);
349+
}
350+
330351
/**
331352
* Manage the content of a repository.
332353
*

lib/Github/Api/Repository/Checks.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
use Github\Exception\MissingArgumentException;
88

99
/**
10-
* @link https://developer.github.com/v3/checks/
10+
* @link https://developer.github.com/v3/checks/
11+
* @deprecated since 2.17 and will be removed in 3.0. Use the "Github\Api\Repository\Checks\CheckRuns" or "Github\Api\Repository\Checks\CheckSuits" api classes instead.
1112
*
1213
* @author Zack Galbreath <zack.galbreath@kitware.com>
1314
*/
@@ -29,6 +30,8 @@ class Checks extends AbstractApi
2930
*/
3031
public function create($username, $repository, array $params = [])
3132
{
33+
@trigger_error(sprintf('The "%s" method is deprecated since knp-labs/php-github-api 2.17 and will be removed in knp-labs/php-github-api 3.0. Use the "Github\Api\Repository\Checks\CheckRuns::create" method instead.', __METHOD__), E_USER_DEPRECATED);
34+
3235
if (!isset($params['name'], $params['head_sha'])) {
3336
throw new MissingArgumentException(['name', 'head_sha']);
3437
}
@@ -48,6 +51,8 @@ public function create($username, $repository, array $params = [])
4851
*/
4952
public function update($username, $repository, $checkRunId, array $params = [])
5053
{
54+
@trigger_error(sprintf('The "%s" method is deprecated since knp-labs/php-github-api 2.17 and will be removed in knp-labs/php-github-api 3.0. Use the "Github\Api\Repository\Checks\CheckRuns::update" method instead.', __METHOD__), E_USER_DEPRECATED);
55+
5156
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId), $params);
5257
}
5358

@@ -63,6 +68,8 @@ public function update($username, $repository, $checkRunId, array $params = [])
6368
*/
6469
public function all($username, $repository, $ref, $params = [])
6570
{
71+
@trigger_error(sprintf('The "%s" method is deprecated since knp-labs/php-github-api 2.17 and will be removed in knp-labs/php-github-api 3.0. Use the "Github\Api\Repository\Checks\CheckRuns::allForReference" method instead.', __METHOD__), E_USER_DEPRECATED);
72+
6673
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($ref).'/check-runs', $params);
6774
}
6875

@@ -77,6 +84,8 @@ public function all($username, $repository, $ref, $params = [])
7784
*/
7885
public function show($username, $repository, $checkRunId)
7986
{
87+
@trigger_error(sprintf('The "%s" method is deprecated since knp-labs/php-github-api 2.17 and will be removed in knp-labs/php-github-api 3.0. Use the "Github\Api\Repository\Checks\CheckRuns::show" method instead.', __METHOD__), E_USER_DEPRECATED);
88+
8089
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId));
8190
}
8291

@@ -91,6 +100,8 @@ public function show($username, $repository, $checkRunId)
91100
*/
92101
public function annotations($username, $repository, $checkRunId)
93102
{
103+
@trigger_error(sprintf('The "%s" method is deprecated since knp-labs/php-github-api 2.17 and will be removed in knp-labs/php-github-api 3.0. Use the "Github\Api\Repository\Checks\CheckRuns::annotations" method instead.', __METHOD__), E_USER_DEPRECATED);
104+
94105
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId).'/annotations');
95106
}
96107
}

0 commit comments

Comments
 (0)