How to Use the GitHub Plugin to Find Pull Requests Merged Without Review
Getting Started with CloudQuery and Syncing GitHub Data #
CloudQuery GitHub integration
plugin. This plugin pulls all your essential GitHub data—issues, pull requests, reviews, and more—into your database. After syncing, you'll be able to run insightful queries like the one we’ve discussed to uncover valuable information about your repositories.The Search for Merges Without Reviews #
How to Find These PRs #
SELECT
i.repository_id,
i.updated_at,
i.id,
i.number,
i.state,
i.title,
(i.pull_request->>'merged_at') AS merged_at,
(i.user->>'login') AS user
FROM github_issues i
LEFT JOIN github_issue_pullrequest_reviews r
ON i._cq_id = r._cq_parent_id
WHERE r._cq_parent_id IS NULL
AND i.is_pull_request IS TRUE
AND i.state = 'closed'
AND (i.pull_request->>'merged_at') IS NOT NULL;
repository_id | updated_at | id | number | state | title | merged_at | user |
---|---|---|---|---|---|---|---|
668613940 | 2024-08-12 17:36:29 | 2461556524 | 1022 | closed | chore: Ignore non existing macro directories | 2024-08-12T17:36:26Z | user1 |
668613940 | 2024-07-11 09:26:55 | 2401235038 | 972 | closed | chore: Switch to googleapis/release-please-action | 2024-07-11T09:26:53Z | user1 |
668613940 | 2024-05-02 12:17:31 | 2275389166 | 833 | closed | Feat: Added IAM Macros Athena | 2024-05-02T12:17:30Z | user2 |
What Tables Are We Using? #
github_issues
: This table holds the issue and pull request data, like the title, state, and author of each PR.github_issue_pullrequest_reviews
: This table logs the reviews for PRs. We’re using aLEFT JOIN
to make sure we grab the PRs that don’t have any reviews associated with them.
Summary #
Written by Ron Shemesh
Ron is a Senior Software Engineer at CloudQuery and has a background in data science and now works as a senior software engineer at CloudQuery. He has experience working in Python, SQL, React, Java and R. At CloudQuery, Ron has worked on our range of integrations and several projects foundational to platform performance. He loves taking on a challenge and using it to improve his skills.