How to Turn a GitHub Issue or PR into a Text File for AI
You found the issue that explains the bug. It’s forty-two comments long, half of them are dependabot bumps and green check-mark notifications, and you want an AI to read the whole thing and tell you what actually got decided. So you copy the URL, paste it into ChatGPT, and hit enter.
Then one of two things happens. The model tells you it can’t open the link. Or it can, technically, but it burns a chunk of your context window fetching a page that’s mostly reactions, edit history, and “+1 same here.” Either way, you didn’t get what you wanted.
There’s a better move: convert the issue or pull request into a plain text or Markdown file first, then hand that to the model. This guide walks through why the direct-URL approach is unreliable, and the fastest way to get a clean, AI-ready file out of any GitHub thread.
Why pasting a GitHub URL into an AI rarely works
Three things quietly work against you when you drop a raw GitHub link into a chat model.
Fetching is inconsistent. Whether a model can read a live URL depends on the product, the plan, and whether browsing is enabled that day. A prompt that worked last week silently fails this week, and you don’t find out until the answer is vague.
The signal-to-noise ratio is terrible. A rendered GitHub thread is not just the conversation. It’s navigation, label chips, reaction counts, “hidden items” separators, CI status comments, and a running ledger of who edited what. When a model ingests that page, most of the tokens it spends are on chrome, not content.
Long threads are expensive. Every token you feed a model costs money or eats into a finite window. A busy issue can run 10,000–15,000 tokens in raw form. Trim it to the parts that matter and you’re often under 2,500 — the same information, a fraction of the weight.
Here’s the shape of a typical cleanup on a real-world thread:
Raw thread (rendered + comments) : ~14,200 tokens
Compiled, bots removed : ~2,180 tokens
Reduction : ~85%
That 85% isn’t lost information. It’s reactions, duplicate context, edit trails, and bot chatter that were never going to help the model reason about your bug.
The fastest way: convert the thread with thread2text
thread2text takes a GitHub issue, pull request, or discussion URL and compiles the entire thread into one clean file. No login, no install, public repositories work out of the box. Three steps.
Step 1 — Paste the link
Drop in any issue or PR URL, for example github.com/owner/repo/issues/1234. Behind the scenes the thread is pulled through GitHub’s official API — no scraping, no browser tricks — so what you get back is the real conversation, in order, with its metadata intact.
Step 2 — Choose a mode
Pick For AI or Readable:
- For AI produces a structured document with deterministic headings — title, state, labels, a summary, the discussion, and the resolution — arranged so a model can parse it without guessing. It keeps the facts and drops the fluff.
- Readable produces a trimmed, prose-first version meant for a human catching up quickly. Same thread, composed for a different reader.
Step 3 — Copy or download
Grab the result as Markdown (.md) or plain text (.txt). Copy it to your clipboard or download the file, then paste it into ChatGPT, Claude, Gemini, or whatever you’re using. That’s the whole loop, and it takes a few seconds.
For AI mode vs Readable mode — which one to use
Reach for For AI when you’re going to ask a model to do something with the thread: summarize the decision, extract action items, draft a reproduction, explain why a change was made. The explicit structure and full metadata give the model firm footing.
Reach for Readable when a person is the audience — you’re onboarding onto an unfamiliar area, reviewing a decision after the fact, or pasting context into a ticket for a teammate. It reads like a briefing instead of a transcript.
A useful habit: if you’re not sure, start with For AI. It carries more of the original signal, and models handle its density better than a human would.
Handling pull requests, not just issues
Pull requests are where a plain diff export falls short. The code changes are only half the story; the why lives in the conversation and the review threads. A good compile of a PR includes:
- the description and linked issues,
- the top-level conversation,
- inline review comments tied to the file and line they were left on,
- the review verdicts (approved, changes requested), and
- optionally, the diff itself.
When you do include the diff, you almost never want the whole thing verbatim. Lockfiles (package-lock.json, yarn.lock, Cargo.lock) and generated files can dwarf the actual change and drown the model in noise. thread2text lets you fold in the diff while skipping those, so the model sees the meaningful edits alongside the discussion that produced them — not 4,000 lines of dependency hashes.
The manual alternatives (and why they’re slower)
You can absolutely do this by hand. It’s worth knowing the options, if only to see what the tool is saving you.
- Copy-paste from the page. Fast to start, but you drag in all the rendered noise and you have to manually skip collapsed items. Fine for a three-comment issue, painful past ten.
- The GitHub REST API.
GET /repos/{owner}/{repo}/issues/{n}and/issues/{n}/commentsreturn the conversation as JSON. Clean data, but you’re now writing a script, paginating results, and reformatting JSON into something readable before you’ve asked the model anything. - The
.diff/.patchURLs. Appending.diffto a PR URL gives you the raw code changes — but only the code, no discussion, and unstructured, so filtering out lockfiles means parsing the diff yourself.
Each of these works. None of them is faster than pasting a link and clicking Convert, which is the entire point.
FAQ
Is it free, and do I need to log in? Yes, it’s free for public repositories with no login required. An optional token unlocks private repositories and higher rate limits.
Does it work on pull requests as well as issues? Yes. It compiles the description, conversation, and inline review threads, with an optional diff that can skip lockfiles and generated files.
Which formats can I export?
Clean Markdown (.md) or plain text (.txt) — copy to clipboard or download the file.
Will it work with ChatGPT, Claude, and Gemini? Yes. The output is plain text, so it pastes into any model or tool that accepts text — nothing is model-specific.
Does it keep code blocks and formatting? Yes. Fenced code, inline code, and links from the original comments are preserved so the model sees them correctly.
Stop feeding models whole web pages and hoping they parse them. Compile the thread into a clean file first, and you’ll spend fewer tokens getting sharper answers.