Skip to content

Commit

Permalink
bug #1005 fix(recipes:update): github api now requires is:pull-reques…
Browse files Browse the repository at this point in the history
…t parameter (alainsharemat)

This PR was submitted for the 2.x branch but it was squashed and merged into the 1.x branch instead.

Discussion
----------

fix(recipes:update): github api now requires is:pull-request parameter

This fix is related to issue #974.

While running `recipes:update`  I got this error:

```shell
Calculating CHANGELOG...
In CurlDownloader.php line 630:

  The "https://api.github.com/search/issues?q=95e75e5e424c5f5f611cc57073e399baaf287570" file could not be downloaded (HTTP/2 422 ):
  {"message":"Query must include 'is:issue' or 'is:pull-request'","documentation_url":"https://docs.github.com/rest/search/search#search-issues-and-pull-requests"}
```

According to github's [documentation](https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#search-issues-and-pull-requests) : `Requests that don't include the is:issue or is:pull-request qualifier will receive an HTTP 422 Unprocessable Entity response`.

Commits
-------

bc89553 fix(recipes:update): github api now requires is:pull-request parameter
  • Loading branch information
fabpot committed Dec 5, 2023
2 parents f1cf401 + bc89553 commit f96b8bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/GithubApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function getCommitDataForPath(string $repo, string $path, string $branch)

public function getPullRequestForCommit(string $commit, string $repo): ?array
{
$data = $this->requestGitHubApi('https://api.github.com/search/issues?q='.$commit);
$data = $this->requestGitHubApi('https://api.github.com/search/issues?q='.$commit.'+is:pull-request');

if (0 === \count($data['items'])) {
return null;
Expand Down

0 comments on commit f96b8bf

Please sign in to comment.