Skip to content

Instantly share code, notes, and snippets.

@ochen1
Created December 30, 2025 05:26
Show Gist options
  • Select an option

  • Save ochen1/ee1509a9173aea2634261cd9eef8b8a5 to your computer and use it in GitHub Desktop.

Select an option

Save ochen1/ee1509a9173aea2634261cd9eef8b8a5 to your computer and use it in GitHub Desktop.
Export your gh PRs to a Markdown file for LLM ingestion
#!/bin/bash
# Export PRs by author AUTHOR to a Markdown file for LLM ingestion
OUTPUT_FILE="AUTHOR-prs-REPO.md"
cat > "$OUTPUT_FILE" << 'EOF'
# Pull Requests by AUTHOR
This document contains all pull requests authored by AUTHOR in the REPO repository.
---
EOF
gh pr list --repo REPO --author AUTHOR --state all --limit 100 --json number,title,state,createdAt,closedAt,mergedAt,body,url | jq -r '
.[] | "## PR #\(.number): \(.title)\n\n**State:** \(.state)\n**Created:** \(.createdAt)\n**Closed:** \(.closedAt // "N/A")\n**Merged:** \(.mergedAt // "N/A")\n**URL:** \(.url)\n\n### Description\n\n\(.body // "No description provided.")\n\n---\n"
' >> "$OUTPUT_FILE"
echo "Exported PRs to $OUTPUT_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment