Skip to content

Fixed updating a pull request #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Github/Api/PullRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ public function create($username, $repository, array $params)
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $params);
}

public function update($username, $repository, array $params)
public function update($username, $repository, $id, array $params)
{
if (isset($params['state']) && !in_array($params['state'], array('open', 'closed'))) {
$params['state'] = 'open';
}

return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $params);
return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id), $params);
}

public function merged($username, $repository, $id)
Expand Down
21 changes: 21 additions & 0 deletions lib/Github/Api/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,25 @@ public function watchers($username, $repository, $page = 1)
'page' => $page
));
}

/**
* Perform a merge
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update phpdoc formatting like on other methods

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pilot fixed in 6df2deb

* @link http://developer.github.com/v3/repos/merging/
*
* @param string $username
* @param string $repository
* @param string $base The name of the base branch that the head will be merged into.
* @param string $head The head to merge. This can be a branch name or a commit SHA1.
* @param string $message Commit message to use for the merge commit. If omitted, a default message will be used.
*
* @return array|null
*/
public function merge($username, $repository, $base, $head, $message = null)
{
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/merges', array(
'base' => $base,
'head' => $head,
'commit_message' => $message
));
}
}