Skip to content
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

Merging a pull request (Not found in the docs) #866

Open
cloudelabs opened this issue Apr 24, 2020 · 1 comment
Open

Merging a pull request (Not found in the docs) #866

cloudelabs opened this issue Apr 24, 2020 · 1 comment

Comments

@cloudelabs
Copy link

@cloudelabs cloudelabs commented Apr 24, 2020

I see that merging a pull request is possible but I couldn't find it in the docs in this repo. Is the document not updated or the feature itself is not available?

https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button

@acrobat
Copy link
Collaborator

@acrobat acrobat commented Apr 24, 2020

The docs entry is indeed missing, but the api code covers this method

public function merge($username, $repository, $id, $message, $sha, $mergeMethod = 'merge', $title = null)
{
if (is_bool($mergeMethod)) {
$mergeMethod = $mergeMethod ? 'squash' : 'merge';
}
if (!in_array($mergeMethod, ['merge', 'squash', 'rebase'], true)) {
throw new InvalidArgumentException(sprintf('"$mergeMethod" must be one of ["merge", "squash", "rebase"] ("%s" given).', $mergeMethod));
}
$params = [
'commit_message' => $message,
'sha' => $sha,
'merge_method' => $mergeMethod,
];
if (is_string($title)) {
$params['commit_title'] = $title;
}
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge', $params);
}

If you can open a pr and add a docs entry for it would be appreciated. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.