Skip to content

Commit 432d2a8

Browse files
committed
Merge branch '2.x'
* 2.x: Update changelog for 2.15.0 release Remove description line from changelog to allow automatic update feature #865 add additional check run methods (bobeagan, acrobat)
2 parents 4619ebd + 03445f2 commit 432d2a8

File tree

4 files changed

+149
-4
lines changed

4 files changed

+149
-4
lines changed

CHANGELOG.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
1-
# Change Log
1+
# Changelog
22

3-
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
3+
## 2.15.0
4+
5+
### Added
6+
- Prepare deprecation of authentication methods ([acrobat](https://github.com/acrobat)) [#870](https://github.com/KnpLabs/php-github-api/issues/870)
7+
- Add Support For GitData Reference Matching Methods ([nickpoulos](https://github.com/nickpoulos)) [#875](https://github.com/KnpLabs/php-github-api/issues/875)
8+
- Make invalid request error more clear ([acrobat](https://github.com/acrobat)) [#880](https://github.com/KnpLabs/php-github-api/issues/880)
9+
- Show user by ID ([genintho](https://github.com/genintho)) [#894](https://github.com/KnpLabs/php-github-api/issues/894)
10+
- add additional check run methods ([bobeagan](https://github.com/bobeagan), [acrobat](https://github.com/acrobat)) [#865](https://github.com/KnpLabs/php-github-api/issues/865)
11+
12+
### Changed
13+
- Added phpstan ([clxkoders](https://github.com/clxkoders)) [#871](https://github.com/KnpLabs/php-github-api/issues/871)
14+
- Increase phpstan to level 4 ([acrobat](https://github.com/acrobat)) [#874](https://github.com/KnpLabs/php-github-api/issues/874)
15+
- [Documentation] Add Missing Children to Pull Request Index ([jimlind](https://github.com/jimlind)) [#877](https://github.com/KnpLabs/php-github-api/issues/877)
16+
- [Documentation] Include links to Pull Request Children on Pull Request Doc. ([jimlind](https://github.com/jimlind)) [#878](https://github.com/KnpLabs/php-github-api/issues/878)
17+
- Fix typo in /lib/Github/Api/RateLimit.php ([yoonper](https://github.com/yoonper)) [#886](https://github.com/KnpLabs/php-github-api/issues/886)
18+
- Don't use deprecated auth in examples ([GrahamCampbell](https://github.com/GrahamCampbell)) [#892](https://github.com/KnpLabs/php-github-api/issues/892)
19+
- Removed shadow-cat ([GrahamCampbell](https://github.com/GrahamCampbell)) [#893](https://github.com/KnpLabs/php-github-api/issues/893)
20+
- Don't urlencode integer values ([acrobat](https://github.com/acrobat)) [#895](https://github.com/KnpLabs/php-github-api/issues/895)
21+
- phpstan level 6 fixes ([acrobat](https://github.com/acrobat), [GrahamCampbell](https://github.com/GrahamCampbell)) [#897](https://github.com/KnpLabs/php-github-api/issues/897)
22+
23+
### Fixed
24+
- fix: use new media type for branch protections ([iBotPeaches](https://github.com/iBotPeaches)) [#881](https://github.com/KnpLabs/php-github-api/issues/881)
25+
- Added missing 'machine-man-preview' accept headers ([vovayatsyuk](https://github.com/vovayatsyuk)) [#883](https://github.com/KnpLabs/php-github-api/issues/883)
26+
- Fix broken roave/bc-check test ([acrobat](https://github.com/acrobat)) [#890](https://github.com/KnpLabs/php-github-api/issues/890)
27+
- Fixed incorrect MissingArgumentException parent constructor values ([acrobat](https://github.com/acrobat)) [#896](https://github.com/KnpLabs/php-github-api/issues/896)
28+
- Added AUTH_ACCESS_TOKEN to allowed methods ([GrahamCampbell](https://github.com/GrahamCampbell)) [#899](https://github.com/KnpLabs/php-github-api/issues/899)
429

530
## 2.14.0
631

doc/repo/checks.md

+31-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $params = [
1313
'details_url' => 'https://nimbleci.com/...',
1414
'output' => {...}
1515
];
16-
$checks = $client->api('repo')->checks()->create('NimbleCI', 'docker-web-tester-behat', $params);
16+
$check = $client->api('repo')->checks()->create('NimbleCI', 'docker-web-tester-behat', $params);
1717
```
1818

1919
### Update an existing check on a commit
@@ -27,5 +27,34 @@ $params = [
2727
'details_url' => 'https://nimbleci.com/...',
2828
'output' => {...}
2929
];
30-
$checks = $client->api('repo')->checks()->create('NimbleCI', 'docker-web-tester-behat', $checkRunId, $params);
30+
$check = $client->api('repo')->checks()->create('NimbleCI', 'docker-web-tester-behat', $checkRunId, $params);
31+
```
32+
33+
### List check runs for a Git reference
34+
35+
https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-git-reference
36+
37+
```php
38+
$params = [
39+
'check_name' => 'my check',
40+
'status' => 'completed',
41+
'filter' => 'latest',
42+
];
43+
$checks = $client->api('repo')->checks()->all('NimbleCI', 'docker-web-tester-behat', $ref, $params);
44+
```
45+
46+
### Get a check run
47+
48+
https://developer.github.com/v3/checks/runs/#get-a-check-run
49+
50+
```php
51+
$check = $client->api('repo')->checks()->show('NimbleCI', 'docker-web-tester-behat', $checkRunId);
52+
```
53+
54+
### List check run annotations
55+
56+
https://developer.github.com/v3/checks/runs/#list-check-run-annotations
57+
58+
```php
59+
$annotations = $client->api('repo')->checks()->annotations('NimbleCI', 'docker-web-tester-behat', $checkRunId);
3160
```

lib/Github/Api/Repository/Checks.php

+52
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,56 @@ public function update($username, $repository, $checkRunId, array $params = [])
5555

5656
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId), $params);
5757
}
58+
59+
/**
60+
* @link https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-git-reference
61+
*
62+
* @param string $username
63+
* @param string $repository
64+
* @param string $ref
65+
* @param array $params
66+
*
67+
* @return array
68+
*/
69+
public function all($username, $repository, $ref, $params = [])
70+
{
71+
// This api is in preview mode, so set the correct accept-header.
72+
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
73+
74+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($ref).'/check-runs', $params);
75+
}
76+
77+
/**
78+
* @link https://developer.github.com/v3/checks/runs/#get-a-check-run
79+
*
80+
* @param string $username
81+
* @param string $repository
82+
* @param string $checkRunId
83+
*
84+
* @return array
85+
*/
86+
public function show($username, $repository, $checkRunId)
87+
{
88+
// This api is in preview mode, so set the correct accept-header.
89+
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
90+
91+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId));
92+
}
93+
94+
/**
95+
* @link https://developer.github.com/v3/checks/runs/#list-check-run-annotations
96+
*
97+
* @param string $username
98+
* @param string $repository
99+
* @param string $checkRunId
100+
*
101+
* @return array
102+
*/
103+
public function annotations($username, $repository, $checkRunId)
104+
{
105+
// This api is in preview mode, so set the correct accept-header.
106+
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
107+
108+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId).'/annotations');
109+
}
58110
}

test/Github/Tests/Api/Repository/ChecksTest.php

+39
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,45 @@ public function shouldUpdateCheck()
7171
$this->assertEquals($expectedValue, $api->update('KnpLabs', 'php-github-api', '123', $data));
7272
}
7373

74+
/**
75+
* @test
76+
*/
77+
public function shouldGetAllChecksForRef()
78+
{
79+
$api = $this->getApiMock();
80+
$api->expects($this->once())
81+
->method('get')
82+
->with('/repos/KnpLabs/php-github-api/commits/cb4abc15424c0015b4468d73df55efb8b60a4a3d/check-runs');
83+
84+
$api->all('KnpLabs', 'php-github-api', 'cb4abc15424c0015b4468d73df55efb8b60a4a3d');
85+
}
86+
87+
/**
88+
* @test
89+
*/
90+
public function shouldShowSingleCheckRun()
91+
{
92+
$api = $this->getApiMock();
93+
$api->expects($this->once())
94+
->method('get')
95+
->with('/repos/KnpLabs/php-github-api/check-runs/14');
96+
97+
$api->show('KnpLabs', 'php-github-api', 14);
98+
}
99+
100+
/**
101+
* @test
102+
*/
103+
public function shouldListCheckRunAnnotations()
104+
{
105+
$api = $this->getApiMock();
106+
$api->expects($this->once())
107+
->method('get')
108+
->with('/repos/KnpLabs/php-github-api/check-runs/14/annotations');
109+
110+
$api->annotations('KnpLabs', 'php-github-api', 14);
111+
}
112+
74113
/**
75114
* @return string
76115
*/

0 commit comments

Comments
 (0)