Skip to content

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

Description

@softower

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

Activity

  1. acrobat commented on Apr 24, 2020

    @acrobat
    Collaborator

    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!

  2. added a commit that references this issue on Apr 24, 2023
    cacec59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions