pull_requests
Creates, updates, deletes, gets or lists a pull_requests resource.
Overview
| Name | pull_requests |
| Type | Resource |
| Id | github.pulls.pull_requests |
Fields
The following fields are returned by SELECT queries:
- list
Response
| Name | Datatype | Description |
|---|---|---|
id | integer (int64) | |
node_id | string | (example: MDExOlB1bGxSZXF1ZXN0MQ==) |
_links | object | |
active_lock_reason | string | (example: too heated) |
assignee | object | A GitHub user. (title: Simple User) |
assignees | array | |
author_association | string | How the author is associated with the repository. (COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNER) (title: author_association, example: OWNER) |
auto_merge | object | The status of auto merging a pull request. (title: Auto merge) |
base | object | |
body | string | (example: Please pull these awesome changes) |
closed_at | string (date-time) | (example: 2011-01-26T19:01:12Z) |
comments_url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/issues/1347/comments) |
commits_url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits) |
created_at | string (date-time) | (example: 2011-01-26T19:01:12Z) |
diff_url | string (uri) | (example: https://github.com/octocat/Hello-World/pull/1347.diff) |
draft | boolean | Indicates whether or not the pull request is a draft. |
head | object | |
html_url | string (uri) | (example: https://github.com/octocat/Hello-World/pull/1347) |
issue_url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/issues/1347) |
labels | array | |
locked | boolean | |
merge_commit_sha | string | (example: e5bd3914e2e596debea16f433f57875b5b90bcd6) |
merged_at | string (date-time) | (example: 2011-01-26T19:01:12Z) |
milestone | object | A collection of related issues and pull requests. (title: Milestone) |
number | integer | |
patch_url | string (uri) | (example: https://github.com/octocat/Hello-World/pull/1347.patch) |
requested_reviewers | array | |
requested_teams | array | |
review_comment_url | string | (example: https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}) |
review_comments_url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments) |
state | string | (example: open) |
statuses_url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e) |
title | string | (example: new-feature) |
updated_at | string (date-time) | (example: 2011-01-26T19:01:12Z) |
url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/pulls/1347) |
user | object | A GitHub user. (title: Simple User) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | owner, repo | state, head, base, sort, direction, per_page, page | Lists pull requests in a specified repository. 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. 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. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
base | string | Filter pulls by base branch name. Example: gh-pages. |
direction | string | The direction of the sort. Default: desc when sort is created or sort is not specified, otherwise asc. |
head | string | Filter pulls by head user or head organization and branch name in the format of user:ref-name or organization:ref-name. For example: github:new-script-format or octocat:test-branch. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
sort | string | What to sort results by. popularity will sort by the number of comments. long-running will sort by date created and will limit the results to pull requests that have been open for more than a month and have had activity within the past month. |
state | string | Either open, closed, or all to filter by state. |
SELECT examples
- list
Lists pull requests in a specified repository.
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.
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.
SELECT
id,
node_id,
_links,
active_lock_reason,
assignee,
assignees,
author_association,
auto_merge,
base,
body,
closed_at,
comments_url,
commits_url,
created_at,
diff_url,
draft,
head,
html_url,
issue_url,
labels,
locked,
merge_commit_sha,
merged_at,
milestone,
number,
patch_url,
requested_reviewers,
requested_teams,
review_comment_url,
review_comments_url,
state,
statuses_url,
title,
updated_at,
url,
user
FROM github.pulls.pull_requests
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND state = '{{ state }}'
AND head = '{{ head }}'
AND base = '{{ base }}'
AND sort = '{{ sort }}'
AND direction = '{{ direction }}'
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;