Skip to content

Commit

Permalink
Merge branch 'master' into code-completion
Browse files Browse the repository at this point in the history
  • Loading branch information
haridarshan committed Mar 24, 2024
2 parents 8a5662f + a162dd3 commit 6bbd59c
Show file tree
Hide file tree
Showing 45 changed files with 923 additions and 114 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/backwards-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ jobs:
name: "Roave BC check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
args: --from=${{ github.event.pull_request.base.sha }}
php-version: '8.2'

- name: Install roave/backward-compatibility-check
run: composer require --dev roave/backward-compatibility-check

- name: Run roave/backward-compatibility-check
run: vendor/bin/roave-backward-compatibility-check --from=${{ github.event.pull_request.base.sha }} --format=github-actions
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -23,7 +23,7 @@ jobs:
coverage: none

- name: Install Composer Dependencies
uses: ramsey/composer-install@v2
uses: ramsey/composer-install@v3

- name: Run phpunit
run: vendor/bin/phpunit --verbose
Expand All @@ -33,15 +33,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: 7.2
coverage: none

- name: Install Composer Dependencies
uses: ramsey/composer-install@v2
uses: ramsey/composer-install@v3

- name: Run phpstan
run: vendor/bin/phpstan analyse --no-progress
27 changes: 27 additions & 0 deletions CHANGELOG-3.X.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 3.14.0

### Added
- Allow php-http/cache-plugin v2 ([GrahamCampbell](https://github.com/GrahamCampbell)) [#1134](https://github.com/KnpLabs/php-github-api/issues/1134)

## 3.13.0

### Added
- Test against php 8.3 ([sergiy-petrov](https://github.com/sergiy-petrov)) [#1124](https://github.com/KnpLabs/php-github-api/issues/1124)
- feat: Secret Scanning Alerts ([haridarshan](https://github.com/haridarshan)) [#1114](https://github.com/KnpLabs/php-github-api/issues/1114)
- feat: User Migration ([haridarshan](https://github.com/haridarshan)) [#1115](https://github.com/KnpLabs/php-github-api/issues/1115)

### Changed
- General chores ([acrobat](https://github.com/acrobat)) [#1125](https://github.com/KnpLabs/php-github-api/issues/1125)

### Fixed
- Fix detection of secondary rate limit ([mathieudz](https://github.com/mathieudz)) [#1126](https://github.com/KnpLabs/php-github-api/issues/1126)

## 3.12.0

### Added
- feat: Support for Organization Runners ([haridarshan](https://github.com/haridarshan), [renovate](https://github.com/renovate)[[bot](https://github.com/bot)]) [#1101](https://github.com/KnpLabs/php-github-api/issues/1101)
- allow psr/http-message v2 ([LordSimal](https://github.com/LordSimal)) [#1122](https://github.com/KnpLabs/php-github-api/issues/1122)

### Changed
- Fixed branch alias ([GrahamCampbell](https://github.com/GrahamCampbell)) [#1109](https://github.com/KnpLabs/php-github-api/issues/1109)

## 3.11.0

### Added
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"require": {
"php": "^7.2.5 || ^8.0",
"ext-json": "*",
"php-http/cache-plugin": "^1.7.1",
"php-http/cache-plugin": "^1.7.1|^2.0",
"php-http/client-common": "^2.3",
"php-http/discovery": "^1.12",
"php-http/httplug": "^2.2",
"php-http/multipart-stream-builder": "^1.1.2",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/http-client-implementation": "^1.0",
"psr/http-factory-implementation": "^1.0",
"psr/http-message": "^1.0",
"psr/http-message": "^1.0|^2.0",
"symfony/polyfill-php80": "^1.17",
"symfony/deprecation-contracts": "^2.2|^3.0",
"phpstan/phpdoc-parser": "^1.21"
Expand All @@ -53,7 +53,7 @@
"extra": {
"branch-alias": {
"dev-2.x": "2.20.x-dev",
"dev-master": "3.11.x-dev"
"dev-master": "3.14-dev"
}
},
"config": {
Expand Down
4 changes: 4 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ v3 APIs:
* [Public keys](currentuser/publickeys.md)
* [Memberships](currentuser/memberships.md)
* [Enterprise](enterprise.md)
* [Secret Scanning Alert](enterprise/secret-scanning.md)
* [Gists](gists.md)
* [Comments](gists/comments.md)
* GitData
Expand Down Expand Up @@ -42,6 +43,7 @@ v3 APIs:
* [Self hosted runners](organization/actions/self_hosted_runners.md)
* [Secrets](organization/actions/secrets.md)
* [Variables](organization/actions/variables.md)
* [Secret Scanning Alert](organization/secret-scanning.md)
* [Projects](project/projects.md)
* [Columns](project/columns.md)
* [Cards](project/cards.md)
Expand Down Expand Up @@ -74,8 +76,10 @@ v3 APIs:
* [Stargazers](repo/stargazers.md)
* [Statuses](repo/statuses.md)
* [Tags](repo/tags.md)
* [Secret Scanning Alert](repo/secret-scanning.md)
* [Search](search.md)
* [Users](users.md)
* [Migrations](user/migration.md)

Additional features:

Expand Down
10 changes: 10 additions & 0 deletions doc/enterprise/secret-scanning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Enterprise / Secret Scanning API
[Back to the "Enterprise API"](../../enterprise.md) | [Back to the navigation](../../README.md)

# List secret-scanning alerts for an Enterprise

https://docs.github.com/en/[email protected]/rest/secret-scanning#list-secret-scanning-alerts-for-an-enterprise

```php
$alerts = $client->api('enterprise')->secretScanning()->alerts('KnpLabs');
```
10 changes: 10 additions & 0 deletions doc/organization/secret-scanning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Organization / Secret Scanning API
[Back to the "Organization API"](../../organization.md) | [Back to the navigation](../../README.md)

# List secret-scanning alerts for an Organization

https://docs.github.com/en/[email protected]/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization

```php
$alerts = $client->api('organization')->secretScanning()->alerts('KnpLabs');
```
37 changes: 37 additions & 0 deletions doc/repo/secret-scanning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Repository / Secret Scanning API
[Back to the "Repos API"](../../repos.md) | [Back to the navigation](../../README.md)

# List secret-scanning alerts for a repository

https://docs.github.com/en/[email protected]/rest/secret-scanning#list-secret-scanning-alerts-for-a-repository

```php
$alerts = $client->api('repos')->secretScanning()->alerts('KnpLabs', 'php-github-api');
```

# Get a secret-scanning alert

https://docs.github.com/en/[email protected]/rest/secret-scanning#get-a-secret-scanning-alert

```php
$alert = $client->api('repos')->secretScanning()->getAlert('KnpLabs', 'php-github-api', $alertNumber);
```

# Update a secret-scanning alert

https://docs.github.com/en/[email protected]/rest/secret-scanning#update-a-secret-scanning-alert

```php
$client->api('repos')->secretScanning()->updateAlert('KnpLabs', 'php-github-api', $alertNumber, [
'state' => 'resolved',
'resolution' => 'wont-fix'
]);
```

# List Locations for a secret-scanning alert

https://docs.github.com/en/[email protected]/rest/secret-scanning#list-locations-for-a-secret-scanning-alert

```php
$locations = $client->api('repos')->secretScanning()->locations('KnpLabs', 'php-github-api', $alertNumber);
```
79 changes: 79 additions & 0 deletions doc/user/migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## User / Migrations API
[Back to the "Users API"](../../users.md) | [Back to the navigation](../../README.md)

# List user migrations

https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#list-user-migrations

```php
$api = $github->api('user')->migration();
$paginator = new Github\ResultPager($github);
$parameters = [];
$migrations = $paginator->fetchAll($api, 'list', $parameters);

do {
foreach ($migrations as $migration) {
// do something
}
$migrations = $paginator->fetchNext();
}
while($paginator->hasNext());
```

# Start a User Migration

https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#start-a-user-migration

```php
$client->users()->migration()->start([
'repositories' => [
'KnpLabs/php-github-api'
],
'lock_repositories' => true,
'exclude_metadata' => false,
'exclude_git_data' => false,
'exclude_attachments' => true,
'exclude_releases' => false,
'exclude_owner_projects' => true,
'org_metadata_only' => false,
'exclude' => [
'Exclude attributes from the API response to improve performance'
]
]);
```

# Get a User Migration Status

https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#get-a-user-migration-status

```php
$status = $client->user()->migration()->status(12, [
'exclude' => [
'exclude attributes'
]
]);
```

# Delete a User Migration Archive

https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#delete-a-user-migration-archive

```php
$client->user()->migration()->deleteArchive(12);
```

# Unlock a User Repository

https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#unlock-a-user-repository

```php
$client->user()->migration()->unlockRepo(12, 'php-github-api');
```

# List repositories for a User Migration

https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28#list-repositories-for-a-user-migration

```php
$repos = $client->user()->migration()->repos(2);
```
1 change: 1 addition & 0 deletions lib/Github/Api/CurrentUser/Watchers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @link https://developer.github.com/v3/activity/watching/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*
* @revised Felipe Valtl de Mello <eu@felipe.im>
*/
class Watchers extends AbstractApi
Expand Down
9 changes: 9 additions & 0 deletions lib/Github/Api/Enterprise.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Github\Api\Enterprise\License;
use Github\Api\Enterprise\ManagementConsole;
use Github\Api\Enterprise\SecretScanning;
use Github\Api\Enterprise\Stats;
use Github\Api\Enterprise\UserAdmin;

Expand Down Expand Up @@ -48,4 +49,12 @@ public function userAdmin()
{
return new UserAdmin($this->getClient());
}

/**
* @return SecretScanning
*/
public function secretScanning(): SecretScanning
{
return new SecretScanning($this->getClient());
}
}
21 changes: 21 additions & 0 deletions lib/Github/Api/Enterprise/SecretScanning.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Github\Api\Enterprise;

use Github\Api\AbstractApi;

class SecretScanning extends AbstractApi
{
/**
* @link https://docs.github.com/en/[email protected]/rest/secret-scanning#list-secret-scanning-alerts-for-an-enterprise
*
* @param string $enterprise
* @param array $params
*
* @return array|string
*/
public function alerts(string $enterprise, array $params = [])
{
return $this->get('/enterprises/'.rawurlencode($enterprise).'/secret-scanning/alerts', $params);
}
}
2 changes: 1 addition & 1 deletion lib/Github/Api/Issue/Labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function deleteLabel($username, $repository, $label)
public function update($username, $repository, $label, $newName, $color)
{
$params = [
'name' => $newName,
'name' => $newName,
'color' => $color,
];

Expand Down
6 changes: 3 additions & 3 deletions lib/Github/Api/Issue/Milestones.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function all($username, $repository, array $params = [])
}

return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge([
'page' => 1,
'state' => 'open',
'sort' => 'due_date',
'page' => 1,
'state' => 'open',
'sort' => 'due_date',
'direction' => 'asc',
], $params));
}
Expand Down
9 changes: 9 additions & 0 deletions lib/Github/Api/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Github\Api\Organization\Hooks;
use Github\Api\Organization\Members;
use Github\Api\Organization\OutsideCollaborators;
use Github\Api\Organization\SecretScanning;
use Github\Api\Organization\Teams;

/**
Expand Down Expand Up @@ -149,4 +150,12 @@ public function runners(): SelfHostedRunners
{
return new SelfHostedRunners($this->getClient());
}

/**
* @return SecretScanning
*/
public function secretScanning(): SecretScanning
{
return new SecretScanning($this->getClient());
}
}
Loading

0 comments on commit 6bbd59c

Please sign in to comment.