Skip to main content

gh-pr-rev-md

gh-pr-rev-md is a Python based CLI to fetch GitHub Pull Request review comments and render them as Markdown.

Features

  • Fetches PR review comments via the GitHub GraphQL API
  • Excludes resolved and outdated comments by default
  • Toggle with --include-resolved and --include-outdated
  • Emits clean Markdown including per-comment metadata and diff context
  • Can print to stdout or write to a timestamped file
  • Configurable via CLI, env, and XDG config file

Installation

Requirements: Python >= 3.9

Recommended with uv (fast installer/runner):

uv pip install gh-pr-rev-md

Alternative (pipx):

pipx install gh-pr-rev-md

Or with pip:

python -m pip install gh-pr-rev-md

Quickstart

gh-pr-rev-md https://github.com/<owner>/<repo>/pull/123

If you don’t set a token, unauthenticated requests are limited (~60/hour) and may hit rate limits. Set GITHUB_TOKEN or use --token.

CLI Usage

gh-pr-rev-md [OPTIONS] PR_URL

Options:

  • --token (env: GITHUB_TOKEN): GitHub token for higher rate limits
  • --config-set: Interactive setup to write an XDG config file
  • --include-resolved: Include resolved review comments
  • --include-outdated: Include outdated review comments (on previous versions of the diff)
  • --output / -o: Save to auto-generated file name
  • --output-file <path>: Save to provided file path

URL format must be: https://github.com/<owner>/<repo>/pull/<number>

Examples

Print to stdout:

gh-pr-rev-md https://github.com/octocat/Hello-World/pull/42

Include resolved comments and save to a generated file:

gh-pr-rev-md --include-resolved --output https://github.com/octocat/Hello-World/pull/42

Write to a specific file:

gh-pr-rev-md --output-file review.md https://github.com/octocat/Hello-World/pull/42

Provide token via env:

GITHUB_TOKEN=ghp_xxx gh-pr-rev-md https://github.com/octocat/Hello-World/pull/42

Configuration

Follows XDG Base Directory spec.

  • User config: $XDG_CONFIG_HOME/gh-pr-rev-md/config.yaml (or ~/.config/gh-pr-rev-md/config.yaml)
  • Supported keys:
    • token: <str>
    • include_resolved: <bool>
    • include_outdated: <bool>
    • output: <bool>
    • output_file: <str>

Create/update interactively:

gh-pr-rev-md --config-set

Output format

The Markdown includes a header with repo/PR metadata, then one section per review comment with author, file, line, created/updated times, a diff-fenced code hunk, and the comment body.

Example snippet:

## Comment #3
**Author:** @octocat
**File:** `app/main.py`
**Line:** 120
**Created:** 2025-08-23 10:05:30 UTC

### Code Context
```diff
@@ def handle():
- old
+ new

Comment

Consider handling None here.


## Development

We use uv for local workflows and Sphinx for docs.

Setup:

```bash
uv venv
uv pip install .[dev]

Run tests:

uv run -m pytest -q --cov=gh_pr_rev_md

Lint:

uv run ruff check .

Docs:

make docs       # builds HTML into docs/_build/html
make docs-serve # serves on http://localhost:8000
make docs-clean

Local development commands:

# Install into a local venv with dev dependencies
make install

# Run the CLI without activating the venv
make run ARGS="https://github.com/owner/repo/pull/123"

# Start a shell with the venv on PATH
make activate

# Alternatively, call the binary directly
.venv/bin/gh-pr-rev-md https://github.com/owner/repo/pull/123

# Or run without installing (one-off)
uvx gh-pr-rev-md https://github.com/owner/repo/pull/123

Project structure

  • gh_pr_rev_md/cli.py: CLI entry point and option handling
  • gh_pr_rev_md/github_client.py: GitHub API client (requests-based)
  • gh_pr_rev_md/formatter.py: Markdown renderer
  • gh_pr_rev_md/config.py: XDG YAML config loader

GitHub token scopes

Read-only access is sufficient. Recommended scopes: repo, read:org for private org repos. For public repos, a token is optional but avoids rate limits.

CI/CD

  • GitHub Actions with uv (astral-sh/setup-uv@v6) and caching enabled
  • Separate jobs for lint, tests, acceptance, security (Bandit), docs, and release
  • Release: tagging vX.Y.Z triggers build/publish in release.yml

Dependabot

Weekly updates for GitHub Actions and uv-managed dependencies via .github/dependabot.yml.

License

MIT

Metadata

Release files for gh-pr-rev-md 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gh-pr-rev-md 0.1.0
File Size Uploaded Provenance
gh_pr_rev_md-0.1.0.tar.gz 26.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gh-pr-rev-md 0.1.0
File Interpreter ABI Platform
gh_pr_rev_md-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.7 kB

Release files / gh_pr_rev_md-0.1.0.tar.gz

Download URL gh_pr_rev_md-0.1.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2f6bb6f0f30d015c4402a9211dc256556715f68bcaac7845bac31cf7dfc74bdd
BLAKE2b-256 checksum
How to use checksums
eb882f3f7597a6a675a3e4991a4da1aed0375ec9ecd474920786cf91c6945a28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / gh_pr_rev_md-0.1.0-py3-none-any.whl

Download URL gh_pr_rev_md-0.1.0-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
237f7be7f80d8a4c98754348db137b180a24158057e30362f10206946507a463
BLAKE2b-256 checksum
How to use checksums
a168375f84ff6aa6937cac774a8ac215fa8d078bdee9418e67046d6457eea3c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for gh-pr-rev-md 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page