mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2024-06-04 14:40:47 +00:00
Merge pull request #315 from weeblr/314-missing-pulls
314 missing pulls
This commit is contained in:
commit
11508111c1
|
@ -210,6 +210,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.
|
||||
|
|
|
@ -321,7 +321,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, $batchSize
|
||||
);
|
||||
|
||||
|
@ -370,36 +370,33 @@ 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;
|
||||
$branch = '';
|
||||
|
||||
foreach ($pull->labels as $label)
|
||||
{
|
||||
// Check if this PR is RTC and has a `PR-` branch label
|
||||
$isRTC = false;
|
||||
$branch = '';
|
||||
|
||||
foreach ($pull->labels as $label)
|
||||
if ($label->name === 'RTC')
|
||||
{
|
||||
if ($label->name === 'RTC')
|
||||
{
|
||||
$isRTC = true;
|
||||
}
|
||||
elseif (substr($label->name, 0, 3) === 'PR-')
|
||||
{
|
||||
$branch = substr($label->name, 3);
|
||||
}
|
||||
$isRTC = true;
|
||||
}
|
||||
elseif (substr($label->name, 0, 3) === 'PR-')
|
||||
{
|
||||
$branch = substr($label->name, 3);
|
||||
}
|
||||
|
||||
// Build the data object to store in the database
|
||||
$pullData = array(
|
||||
(int) $pull->number,
|
||||
$this->getDb()->quote(HTMLHelper::_('string.truncate', $pull->title, 150)),
|
||||
$this->getDb()->quote(HTMLHelper::_('string.truncate', $pull->body, 100)),
|
||||
$this->getDb()->quote($pull->pull_request->html_url),
|
||||
(int) $isRTC,
|
||||
$this->getDb()->quote($branch),
|
||||
);
|
||||
|
||||
$data[] = implode(',', $pullData);
|
||||
}
|
||||
|
||||
// Build the data object to store in the database
|
||||
$pullData = array(
|
||||
(int) $pull->number,
|
||||
$this->getDb()->quote(HTMLHelper::_('string.truncate', $pull->title, 150)),
|
||||
$this->getDb()->quote(HTMLHelper::_('string.truncate', $pull->body, 100)),
|
||||
$this->getDb()->quote($pull->html_url),
|
||||
(int) $isRTC,
|
||||
$this->getDb()->quote($branch),
|
||||
);
|
||||
|
||||
$data[] = implode(',', $pullData);
|
||||
}
|
||||
|
||||
// If there are no pulls to insert then bail, assume we're finished
|
||||
|
|
Loading…
Reference in New Issue
Block a user