diff --git a/lib/Github/Api/PullRequest.php b/lib/Github/Api/PullRequest.php index aed711a6c34..c322c00f003 100644 --- a/lib/Github/Api/PullRequest.php +++ b/lib/Github/Api/PullRequest.php @@ -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) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 0b7deab20ef..1bac1ed8687 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -331,4 +331,25 @@ public function watchers($username, $repository, $page = 1) 'page' => $page )); } + + /** + * Perform a merge + * @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 + )); + } }