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
softower opened this issue Apr 24, 2020 · 1 comment · May be fixed by #1116
Open

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

softower opened this issue Apr 24, 2020 · 1 comment · May be fixed by #1116
Labels
documentation good first issue Ideal for your first contribution!

Comments

@softower
Copy link

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 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!

@acrobat acrobat closed this as completed Apr 24, 2020
@acrobat acrobat reopened this Apr 24, 2020
@acrobat acrobat added documentation good first issue Ideal for your first contribution! labels Apr 24, 2020
haridarshan added a commit to haridarshan/php-github-api that referenced this issue Apr 24, 2023
Signed-off-by: Hari Darshan Gorana <[email protected]>
@haridarshan haridarshan linked a pull request Apr 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation good first issue Ideal for your first contribution!
Projects
None yet
2 participants