https://github.com/joshbeard/gh-issue-export
Quick CLI tool to export GitHub issues
https://github.com/joshbeard/gh-issue-export
Last synced: about 1 year ago
JSON representation
Quick CLI tool to export GitHub issues
- Host: GitHub
- URL: https://github.com/joshbeard/gh-issue-export
- Owner: joshbeard
- Created: 2025-04-03T23:05:18.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-03T23:07:00.000Z (about 1 year ago)
- Last Synced: 2025-05-08T19:05:40.523Z (about 1 year ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GitHub Issue Exporter
A simple command-line tool to export GitHub issues and pull requests in a format
optimized for AI/LLM context. This was mostly generated by Claude.
## Features
- Export any GitHub issue or pull request by specifying owner, repository, and issue number
- Supports both issues and pull requests
- Extracts all linked URLs from the issue/PR and comments
- For pull requests, includes additional details like commit count, changed files, etc.
- Outputs in JSON format or text format optimized for LLM input
- Easy URL-like syntax support (e.g., `joshbeard/web-indexer/issue/4`)
## Installation
```bash
go install github.com/joshbeard/gh-issue-exporter@latest
```
Or clone and build:
```bash
git clone https://github.com/joshbeard/gh-issue-exporter.git
cd gh-issue-exporter
go build
```
## Usage
You'll need a GitHub personal access token with at least `repo` scope permissions.
### Command Line Arguments
```bash
# Using command line flags
gh-issue-exporter -owner=joshbeard -repo=web-indexer -number=4 -token=your_github_token
# Using environment variable for token
export GITHUB_TOKEN=your_github_token
gh-issue-exporter -owner=joshbeard -repo=web-indexer -number=4
# Save output to a file
gh-issue-exporter -owner=joshbeard -repo=web-indexer -number=4 -output=issue.json
# Using URL-like format
gh-issue-exporter joshbeard/web-indexer/issue/4
# Output in text format (better for direct LLM input)
gh-issue-exporter joshbeard/web-indexer/issue/4 -text
```
### Output Formats
#### JSON Format (default)
The tool outputs JSON by default:
```json
{
"title": "Example Issue",
"number": 4,
"state": "open",
"url": "https://github.com/joshbeard/web-indexer/issues/4",
"created_at": "2023-04-01T12:34:56Z",
"updated_at": "2023-04-02T12:34:56Z",
"author": "joshbeard",
"body": "This is an example issue description.",
"labels": ["bug", "high-priority"],
"comments": [
{
"author": "contributor",
"body": "I found the issue in main.go",
"created_at": "2023-04-01T13:45:32Z"
}
],
"linked_urls": [
"https://github.com/joshbeard/web-indexer/blob/main/main.go",
"https://example.com/related-doc"
],
"is_pull_request": false
}
```
For pull requests, additional fields are included:
```json
{
"title": "Add search functionality",
"number": 5,
"state": "open",
"url": "https://github.com/joshbeard/web-indexer/pull/5",
"created_at": "2023-04-03T10:15:20Z",
"updated_at": "2023-04-03T14:30:45Z",
"author": "contributor",
"body": "This PR adds search functionality to the application.",
"labels": ["enhancement"],
"comments": [],
"linked_urls": [
"https://github.com/joshbeard/web-indexer/blob/feature/search/README.md"
],
"is_pull_request": true,
"pr_details": {
"commits": 3,
"additions": 120,
"deletions": 45,
"changed_files": 5,
"merge_status": "clean",
"commit_urls": [
"https://github.com/joshbeard/web-indexer/commit/abc123",
"https://github.com/joshbeard/web-indexer/commit/def456",
"https://github.com/joshbeard/web-indexer/commit/ghi789"
]
}
}
```
#### Text Format
Use the `-text` flag for a more LLM-friendly format:
```
# GitHub Issue: Example Issue
URL: https://github.com/joshbeard/web-indexer/issues/4
Number: #4
State: open
Author: joshbeard
Created: 2023-04-01T12:34:56Z
Updated: 2023-04-02T12:34:56Z
Labels: bug, high-priority
## Description
This is an example issue description.
## Comments
### Comment 1 (by contributor on 2023-04-01T13:45:32Z)
I found the issue in main.go
## Linked URLs
- https://github.com/joshbeard/web-indexer/blob/main/main.go
- https://example.com/related-doc
```
For pull requests, the text format includes PR-specific details:
```
# GitHub Pull Request: Add search functionality
URL: https://github.com/joshbeard/web-indexer/pull/5
Number: #5
State: open
Author: contributor
Created: 2023-04-03T10:15:20Z
Updated: 2023-04-03T14:30:45Z
Labels: enhancement
## Pull Request Details
Commits: 3
Changed Files: 5
Additions: 120
Deletions: 45
Merge Status: clean
## Description
This PR adds search functionality to the application.
## Linked URLs
- https://github.com/joshbeard/web-indexer/blob/feature/search/README.md
## Commit URLs
- https://github.com/joshbeard/web-indexer/commit/abc123
- https://github.com/joshbeard/web-indexer/commit/def456
- https://github.com/joshbeard/web-indexer/commit/ghi789
```