Table: github_search_pull_request - Query GitHub Pull Requests using SQL
GitHub Pull Requests is a feature within GitHub that allows developers to propose changes to a repository. It provides a platform for code review and discussion about the proposed changes before they are merged into the codebase. GitHub Pull Requests helps in maintaining the integrity and quality of the code in a repository by ensuring that all changes are reviewed and approved before they are incorporated.
Table Usage Guide
The github_search_pull_request
table provides insights into pull requests within GitHub. As a developer or project manager, explore pull request-specific details through this table, including status, creator, assignee, and associated metadata. Utilize it to monitor the progress of proposed changes, manage code reviews, and ensure the quality of the code in your repositories.
Important Notes
- You must always include at least one search term when searching pull requests in the where or join clause using the
query
column. You can narrow the results using these search qualifiers in any combination. See Searching issues and pull requests for details on the GitHub query syntax.
Examples
List pull requests by the title, body, or comments
Explore which GitHub pull requests match certain criteria within the title, body, or comments. This can be useful for identifying relevant discussions or changes related to specific topics or keywords.
select title, id, state, created_at, repository_full_name, urlfrom github_search_pull_requestwhere query = 'github_search_issue in:title in:body in:comments';
select title, id, state, created_at, repository_full_name, urlfrom github_search_pull_requestwhere query = 'github_search_issue in:title in:body in:comments';
List pull requests in open state assigned to a specific user
Determine the areas in which a specific user has been assigned open pull requests for a particular repository. This is useful for project managers to track individual contributions and progress in a collaborative environment.
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'is:open assignee:c0d3r-arnab repo:turbot/steampipe-plugin-github';
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'is:open assignee:c0d3r-arnab repo:turbot/steampipe-plugin-github';
List pull requests with public visibility assigned to a specific user
Determine the areas in which a specific user has been assigned public visibility pull requests in a particular GitHub repository. This can be useful to track a user's involvement and contribution to publicly visible projects.
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'is:public assignee:c0d3r-arnab repo:turbot/steampipe-plugin-github';
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'is:public assignee:c0d3r-arnab repo:turbot/steampipe-plugin-github';
List pull requests not linked to an issue
Identify instances where open pull requests are not linked to an issue within the 'turbot/steampipe-plugin-github' repository. This can help to uncover potential oversights in issue tracking and ensure all code changes are properly documented.
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'is:open -linked:issue repo:turbot/steampipe-plugin-github';
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'is:open -linked:issue repo:turbot/steampipe-plugin-github';
List pull requests with over 50 comments
Determine the areas in which pull requests have sparked significant discussion, by identifying those with over 50 comments. This can provide insights into contentious or complex issues within your organization's GitHub repositories.
select title, id, total_comments_count, state, created_at, urlfrom github_search_pull_requestwhere query = 'org:turbot comments:>50';
select title, id, total_comments_count, state, created_at, urlfrom github_search_pull_requestwhere query = 'org:turbot comments:>50';
List open draft pull requests
Explore the open draft pull requests in your GitHub organization. This could be used to identify unfinished work and help prioritize tasks for your development team.
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'org:turbot draft:true state:open';
select title, id, state, created_at, urlfrom github_search_pull_requestwhere query = 'org:turbot draft:true state:open';
List pull requests that took more than 30 days to close
Determine the areas in which pull requests have taken more than a month to close. This can help in identifying bottlenecks in the code review process and provide insights for improving efficiency.
select title, id, state, created_at, closed_at, urlfrom github_search_pull_requestwhere query = 'org:turbot state:closed' and closed_at > (created_at + interval '30' day);
select title, id, state, created_at, closed_at, urlfrom github_search_pull_requestwhere query = 'org:turbot state:closed' and closed_at > datetime(created_at, '+30 days');
Schema for github_search_pull_request
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
active_lock_reason | text | Reason that the conversation was locked. | |
additions | bigint | The number of additions in this pull request. | |
assignees | jsonb | A list of Users assigned to the pull request. | |
author | jsonb | The author of the pull request. | |
author_association | text | Author's association with the pull request. | |
base_ref_name | text | Identifies the name of the base Ref associated with the pull request, even if the ref has been deleted. | |
body | text | The body as Markdown. | |
changed_files | bigint | The number of files changed in this pull request. | |
checks_url | text | URL for the checks of this pull request. | |
closed | boolean | If true, pull request is closed. | |
closed_at | timestamp with time zone | Timestamp when the pull request was closed. | |
created_at | timestamp with time zone | Timestamp when the pull request was created. | |
created_via_email | boolean | If true, pull request comment was created via email. | |
deletions | bigint | The number of deletions in this pull request. | |
editor | jsonb | The actor who edited the pull request's body. | |
head_ref_name | text | Identifies the name of the head Ref associated with the pull request, even if the ref has been deleted. | |
head_ref_oid | text | Identifies the oid/sha of the head ref associated with the pull request, even if the ref has been deleted. | |
id | bigint | The ID of the pull request. | |
includes_created_edit | boolean | If true, this pull request was edited and includes an edit with the creation data. | |
is_cross_repository | boolean | If true, head and base repositories are different. | |
is_draft | boolean | If true, the pull request is a draft. | |
is_read_by_user | boolean | If true, this pull request was read by the current user. | |
last_edited_at | timestamp with time zone | Timestamp the editor made the last edit. | |
locked | boolean | If true, the pull request is locked. | |
login_id | text | =, !=, ~~, ~~*, !~~, !~~* | Unique identifier for the user login. |
maintainer_can_modify | boolean | If true, maintainers can modify the pull request. | |
mergeable | text | Whether or not the pull request can be merged based on the existence of merge conflicts. | |
merged | boolean | If true, the pull request was merged. | |
merged_at | timestamp with time zone | Timestamp when pull request was merged. | |
merged_by | jsonb | The actor who merged the pull request. | |
milestone | jsonb | The milestone associated with the pull request. | |
node_id | text | The node ID of the pull request. | |
number | bigint | The number of the pull request. | |
permalink | text | Permanent URL for the pull request. | |
published_at | timestamp with time zone | Timestamp the pull request was published. | |
query | text | = | The query provided for the search. |
repository_full_name | text | The full name of the repository the pull request belongs to. | |
revert_url | text | URL to revert the pull request. | |
review_decision | text | The current status of this pull request with respect to code review. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
state | text | The current state of the pull request. | |
text_matches | jsonb | The text match details. | |
title | text | The title of the pull request. | |
total_comments_count | bigint | The number of comments on the pull request. | |
updated_at | timestamp with time zone | Timestamp when the pull request was last updated. | |
url | text | URL of the pull request. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- github
You can pass the configuration to the command with the --config
argument:
steampipe_export_github --config '<your_config>' github_search_pull_request