Skip to content

Latest commit

 

History

History
97 lines (67 loc) · 4.29 KB

File metadata and controls

97 lines (67 loc) · 4.29 KB
name example route scope type
Create a pull request
octokit.rest.pulls.create({ owner, repo, head, base })
POST /repos/{owner}/{repo}/pulls
pulls
API method

Create a pull request

Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.

To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."

This endpoint supports the following custom media types. For more information, see "Media types."

  • application/vnd.github.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
octokit.rest.pulls.create({
  owner,
  repo,
  head,
  base,
});

Parameters

name required description
owneryes

The account owner of the repository. The name is not case sensitive.

repoyes

The name of the repository without the .git extension. The name is not case sensitive.

titleno

The title of the new pull request. Required unless issue is specified.

headyes

The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.

head_repono

The name of the repository where the changes in the pull request were made. This field is required for cross-repository pull requests if both repositories are owned by the same organization.

baseyes

The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.

bodyno

The contents of the pull request.

maintainer_can_modifyno

Indicates whether maintainers can modify the pull request.

draftno

Indicates whether the pull request is a draft. See "Draft Pull Requests" in the GitHub Help documentation to learn more.

issueno

An issue in the repository to convert to a pull request. The issue title, body, and comments will become the title, body, and comments on the new pull request. Required unless title is specified.

See also: GitHub Developer Guide documentation.