Table: github_search_commit - Query GitHub Commits using SQL
GitHub Commits is a feature within the GitHub service that allows users to make changes to a repository. Each commit corresponds to a specific change made to the repository, and includes information about the author, the date of the commit, and an associated message describing the change. GitHub Commits form the core of GitHub's version control functionality.
Table Usage Guide
The github_search_commit
table enables insights into commit activities within GitHub repositories. As a developer or project manager, leverage this table to track changes, monitor project progress, and maintain version control. Utilize it to search for specific commits based on various criteria, such as author, date, and associated message.
Important Notes
- You must always include at least one search term when searching source code in the where or join clause using the
query
column. You can narrow the results using these commit search qualifiers in any combination. See Searching commits for details on the GitHub query syntax.
Examples
List searched commits within organization's repositories
This query is useful for tracking specific changes or additions made within an organization's repositories, such as identifying when a certain table was added. It provides a way to monitor and review the evolution of the codebase, enhancing oversight and control over the development process.
select sha, query, html_url, repository_full_name, scorefrom github_search_commitwhere query = 'Add table github_my_star org:turbot';
select sha, query, html_url, repository_full_name, scorefrom github_search_commitwhere query = 'Add table github_my_star org:turbot';
List searched commits within a user's repositories
Explore the specific commits in a user's GitHub repositories that match a particular search term. This is useful for tracking changes related to specific features or issues.
select sha, query, html_url, scorefrom github_search_commitwhere query = 'Add table github_my_star user:turbot';
select sha, query, html_url, scorefrom github_search_commitwhere query = 'Add table github_my_star user:turbot';
List searched commits within a user's specific repository
Determine the areas in which specific changes have been made within a user's specific repository. This can be beneficial for tracking the development and modifications of a project over time.
select sha, query, html_url, scorefrom github_search_commitwhere query = 'Add table github_my_star repo:turbot/steampipe-plugin-github';
select sha, query, html_url, scorefrom github_search_commitwhere query = 'Add table github_my_star repo:turbot/steampipe-plugin-github';
List searched commits by author
Explore which commits have been made by a specific author in a particular GitHub repository. This can be useful to understand an author's contribution history and impact on a project.
select sha, query, html_url, scorefrom github_search_commitwhere query = 'author:VincentHardouin repo:turbot/steampipe-plugin-github';
select sha, query, html_url, scorefrom github_search_commitwhere query = 'author:VincentHardouin repo:turbot/steampipe-plugin-github';
List searched commits committed within the specified date range
Explore specific commits made within a certain date range on the 'turbot/steampipe-plugin-github' repository. This can be useful for tracking project progress or reviewing changes made during a specific period.
select sha, query, html_url, scorefrom github_search_commitwhere query = 'committer-date:2021-11-16..2021-11-23 repo:turbot/steampipe-plugin-github';
select sha, query, html_url, scorefrom github_search_commitwhere query = 'committer-date:2021-11-16..2021-11-23 repo:turbot/steampipe-plugin-github';
List searched commits by hash
Explore the specific commits in a GitHub repository by searching for a particular hash. This is useful for tracking changes and understanding the history of a project.
select sha, query, html_url, scorefrom github_search_commitwhere query = 'hash:b0566eafb30e0595651c14a4c499b16e1c443767 repo:turbot/steampipe-plugin-github';
select sha, query, html_url, scorefrom github_search_commitwhere query = 'hash:b0566eafb30e0595651c14a4c499b16e1c443767 repo:turbot/steampipe-plugin-github';
List searched commits by parent
Explore which commits on GitHub have a specific parent commit. This can be useful to track changes made in a project over time, understand the evolution of code, and identify the impact of a particular commit.
select sha, query, html_url, scorefrom github_search_commitwhere query = 'parent:b0566ea';
select sha, query, html_url, scorefrom github_search_commitwhere query = 'parent:b0566ea';
List searched commits by merge commits
Explore which commits have been merged into the 'turbot/steampipe-plugin-azure' repository. This can be useful in identifying the changes made to the repository and tracking the progress of the project.
select sha, query, html_url, scorefrom github_search_commitwhere query = 'merge:true repo:turbot/steampipe-plugin-azure';
select sha, query, html_url, scorefrom github_search_commitwhere query = 'merge:true repo:turbot/steampipe-plugin-azure';
List repository details
Explore the specifics of a GitHub repository, including its name, ID, and owner, by using this query. This is particularly useful for gaining insights into the repository's details without having to manually sift through GitHub's interface.
select sha, repository -> 'name' as repo_name, repository ->> 'id' as repo_id, repository ->> 'html_url' as repo_html_url, jsonb_pretty(repository -> 'owner') as repo_ownerfrom github_search_commitwhere query = 'hash:b0566eafb30e0595651c14a4c499b16e1c443767 repo:turbot/steampipe-plugin-github';
select sha, json_extract(repository, '$.name') as repo_name, json_extract(repository, '$.id') as repo_id, json_extract(repository, '$.html_url') as repo_html_url, repository -> 'owner' as repo_ownerfrom github_search_commitwhere query = 'hash:b0566eafb30e0595651c14a4c499b16e1c443767 repo:turbot/steampipe-plugin-github';
Schema for github_search_commit
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
author | jsonb | The author details. | |
comments_url | text | The API URL of the comments made on the commit. | |
commit | jsonb | The commit details. | |
committer | jsonb | The committer details. | |
html_url | text | The Github URL of the commit. | |
login_id | text | =, !=, ~~, ~~*, !~~, !~~* | Unique identifier for the user login. |
parents | jsonb | The parent details. | |
query | text | = | The query used to match the commit. |
repository | jsonb | The repository details of the commit. | |
repository_full_name | text | The full name of the repository (login/repo-name). | |
score | double precision | The score of the commit. | |
sha | text | The SHA of the commit. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
url | text | The API URL of the commit. |
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_commit