GitHub CLI: Extract PR Review Comments for Fixing Issues in Cursor
Use Case:
This snippet helps extract PR review comments and their associated files and line numbers. It can be used in Cursor (AI-powered code editor) to quickly identify issues and apply suggested fixes.
Explanation:
gh api /repos/<organisation>/<repo-name>/pulls/627/comments
– Fetches all comments on PR #627 from the specified repository.- Pipes to
jq
– Extracts relevant fields for processing:reviewer
→ Username of the commenter.comment
→ The review comment text (suggested fix).file
→ The file where the issue exists.line
→ The exact line number of the issue.
Example output:
How to Use in Cursor:
- Run the command to extract PR comments.
- Use Cursor AI to apply suggested fixes to the identified files.
- Verify changes and commit the fixes efficiently.
Automate code review fixes and speed up your workflow! 🚀