diff --git a/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php b/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php index cedf0d5..e692ed8 100644 --- a/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php +++ b/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php @@ -211,6 +211,25 @@ class GitHub return $this->processResponse($this->client->get($prepared['url'], $prepared['headers'])); } + /** + * Get a list of the open pull requests for a repository. + * + * @param string $user The name of the owner of the GitHub repository. + * @param string $repo The name of the GitHub repository. + * @param integer $page The page number from which to get items. + * @param integer $limit The number of items on a page. + * + * @return Response + * + * @since 3.0.0 + */ + public function getOpenPulls($user, $repo, $page = 0, $limit = 0) + { + $prepared = $this->prepareRequest("/repos/$user/$repo/pulls", $page, $limit); + + return $this->processResponse($this->client->get($prepared['url'], $prepared['headers'])); + } + /** * Get an option from the connector. * diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index 6ae242a..3ad6387 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -508,7 +508,7 @@ class PullsModel extends AbstractModel // TODO - Option to configure the batch size $batchSize = 100; - $pullsResponse = Helper::initializeGithub()->getOpenIssues( + $pullsResponse = Helper::initializeGithub()->getOpenPulls( $this->getState()->get('github_user'), $this->getState()->get('github_repo'), $page, @@ -573,8 +573,6 @@ class PullsModel extends AbstractModel foreach ($pulls as $pull) { - if (isset($pull->pull_request)) - { // Check if this PR is RTC and has a `PR-` branch label $isRTC = false; $isNPM = false; @@ -618,14 +616,13 @@ class PullsModel extends AbstractModel $this->getDb()->quote( HTMLHelper::_('string.truncate', $pull->body, 100) ), - $this->getDb()->quote($pull->pull_request->html_url), + $this->getDb()->quote($pull->html_url), (int) $isRTC, (int) $isNPM, $this->getDb()->quote($branch), ]; $data[] = implode(',', $pullData); - } } // If there are no pulls to insert then bail, assume we're finished