Skip to content

Commit 9dc93fa

Browse files
authored
Merge branch 'KnpLabs:master' into master
2 parents 33b4b6a + 67398b0 commit 9dc93fa

File tree

27 files changed

+787
-5
lines changed

27 files changed

+787
-5
lines changed

.github/workflows/backwards-compatibility.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ jobs:
1212
with:
1313
fetch-depth: 0
1414

15-
- name: Roave BC Check
16-
uses: docker://nyholm/roave-bc-check-ga
15+
- name: Install PHP
16+
uses: shivammathur/setup-php@v2
1717
with:
18-
args: --from=${{ github.event.pull_request.base.sha }}
18+
php-version: '8.2'
19+
20+
- name: Install roave/backward-compatibility-check
21+
run: composer require --dev roave/backward-compatibility-check
22+
23+
- name: Run roave/backward-compatibility-check
24+
run: vendor/bin/roave-backward-compatibility-check --from=${{ github.event.pull_request.base.sha }} --format=github-actions

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
14+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
1515

1616
steps:
1717
- uses: actions/checkout@v4

doc/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ v3 APIs:
1414
* [Public keys](currentuser/publickeys.md)
1515
* [Memberships](currentuser/memberships.md)
1616
* [Enterprise](enterprise.md)
17+
* [Secret Scanning Alert](enterprise/secret-scanning.md)
1718
* [Gists](gists.md)
1819
* [Comments](gists/comments.md)
1920
* GitData
@@ -42,6 +43,7 @@ v3 APIs:
4243
* [Self hosted runners](organization/actions/self_hosted_runners.md)
4344
* [Secrets](organization/actions/secrets.md)
4445
* [Variables](organization/actions/variables.md)
46+
* [Secret Scanning Alert](organization/secret-scanning.md)
4547
* [Projects](project/projects.md)
4648
* [Columns](project/columns.md)
4749
* [Cards](project/cards.md)
@@ -74,8 +76,10 @@ v3 APIs:
7476
* [Stargazers](repo/stargazers.md)
7577
* [Statuses](repo/statuses.md)
7678
* [Tags](repo/tags.md)
79+
* [Secret Scanning Alert](repo/secret-scanning.md)
7780
* [Search](search.md)
7881
* [Users](users.md)
82+
* [Migrations](user/migration.md)
7983

8084
Additional features:
8185

doc/enterprise/secret-scanning.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Enterprise / Secret Scanning API
2+
[Back to the "Enterprise API"](../../enterprise.md) | [Back to the navigation](../../README.md)
3+
4+
# List secret-scanning alerts for an Enterprise
5+
6+
https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-an-enterprise
7+
8+
```php
9+
$alerts = $client->api('enterprise')->secretScanning()->alerts('KnpLabs');
10+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Organization / Secret Scanning API
2+
[Back to the "Organization API"](../../organization.md) | [Back to the navigation](../../README.md)
3+
4+
# List secret-scanning alerts for an Organization
5+
6+
https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization
7+
8+
```php
9+
$alerts = $client->api('organization')->secretScanning()->alerts('KnpLabs');
10+
```

doc/repo/secret-scanning.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Repository / Secret Scanning API
2+
[Back to the "Repos API"](../../repos.md) | [Back to the navigation](../../README.md)
3+
4+
# List secret-scanning alerts for a repository
5+
6+
https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-a-repository
7+
8+
```php
9+
$alerts = $client->api('repos')->secretScanning()->alerts('KnpLabs', 'php-github-api');
10+
```
11+
12+
# Get a secret-scanning alert
13+
14+
https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#get-a-secret-scanning-alert
15+
16+
```php
17+
$alert = $client->api('repos')->secretScanning()->getAlert('KnpLabs', 'php-github-api', $alertNumber);
18+
```
19+
20+
# Update a secret-scanning alert
21+
22+
https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#update-a-secret-scanning-alert
23+
24+
```php
25+
$client->api('repos')->secretScanning()->updateAlert('KnpLabs', 'php-github-api', $alertNumber, [
26+
'state' => 'resolved',
27+
'resolution' => 'wont-fix'
28+
]);
29+
```
30+
31+
# List Locations for a secret-scanning alert
32+
33+
https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-locations-for-a-secret-scanning-alert
34+
35+
```php
36+
$locations = $client->api('repos')->secretScanning()->locations('KnpLabs', 'php-github-api', $alertNumber);
37+
```

doc/user/migration.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
## User / Migrations API
2+
[Back to the "Users API"](../../users.md) | [Back to the navigation](../../README.md)
3+
4+
# List user migrations
5+
6+
https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#list-user-migrations
7+
8+
```php
9+
$api = $github->api('user')->migration();
10+
$paginator = new Github\ResultPager($github);
11+
$parameters = [];
12+
$migrations = $paginator->fetchAll($api, 'list', $parameters);
13+
14+
do {
15+
foreach ($migrations as $migration) {
16+
// do something
17+
}
18+
$migrations = $paginator->fetchNext();
19+
}
20+
while($paginator->hasNext());
21+
```
22+
23+
# Start a User Migration
24+
25+
https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#start-a-user-migration
26+
27+
```php
28+
$client->users()->migration()->start([
29+
'repositories' => [
30+
'KnpLabs/php-github-api'
31+
],
32+
'lock_repositories' => true,
33+
'exclude_metadata' => false,
34+
'exclude_git_data' => false,
35+
'exclude_attachments' => true,
36+
'exclude_releases' => false,
37+
'exclude_owner_projects' => true,
38+
'org_metadata_only' => false,
39+
'exclude' => [
40+
'Exclude attributes from the API response to improve performance'
41+
]
42+
]);
43+
```
44+
45+
# Get a User Migration Status
46+
47+
https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#get-a-user-migration-status
48+
49+
```php
50+
$status = $client->user()->migration()->status(12, [
51+
'exclude' => [
52+
'exclude attributes'
53+
]
54+
]);
55+
```
56+
57+
# Delete a User Migration Archive
58+
59+
https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#delete-a-user-migration-archive
60+
61+
```php
62+
$client->user()->migration()->deleteArchive(12);
63+
```
64+
65+
# Unlock a User Repository
66+
67+
https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#unlock-a-user-repository
68+
69+
```php
70+
$client->user()->migration()->unlockRepo(12, 'php-github-api');
71+
```
72+
73+
# List repositories for a User Migration
74+
75+
https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#list-repositories-for-a-user-migration
76+
77+
```php
78+
$repos = $client->user()->migration()->repos(2);
79+
```

lib/Github/Api/CurrentUser/Watchers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @link https://developer.github.com/v3/activity/watching/
99
*
1010
* @author Joseph Bielawski <stloyd@gmail.com>
11+
*
1112
* @revised Felipe Valtl de Mello <eu@felipe.im>
1213
*/
1314
class Watchers extends AbstractApi

lib/Github/Api/Enterprise.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Github\Api\Enterprise\License;
66
use Github\Api\Enterprise\ManagementConsole;
7+
use Github\Api\Enterprise\SecretScanning;
78
use Github\Api\Enterprise\Stats;
89
use Github\Api\Enterprise\UserAdmin;
910

@@ -48,4 +49,12 @@ public function userAdmin()
4849
{
4950
return new UserAdmin($this->getClient());
5051
}
52+
53+
/**
54+
* @return SecretScanning
55+
*/
56+
public function secretScanning(): SecretScanning
57+
{
58+
return new SecretScanning($this->getClient());
59+
}
5160
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Github\Api\Enterprise;
4+
5+
use Github\Api\AbstractApi;
6+
7+
class SecretScanning extends AbstractApi
8+
{
9+
/**
10+
* @link https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-an-enterprise
11+
*
12+
* @param string $enterprise
13+
* @param array $params
14+
*
15+
* @return array|string
16+
*/
17+
public function alerts(string $enterprise, array $params = [])
18+
{
19+
return $this->get('/enterprises/'.rawurlencode($enterprise).'/secret-scanning/alerts', $params);
20+
}
21+
}

0 commit comments

Comments
 (0)