Skip to content

thenarfer/issues-to-txt

Repository files navigation

Absolutely — let’s button this up and ship v1. Below is a full, updated README.md you can drop in, plus a copy-paste command sequence to create the GitHub repo, push the code, and publish a v0.1.0 release.


Updated README.md (replace file)

# GitHub Issues Exporter

Export issues from repositories you can access into a tidy `.txt`, plus `.jsonl` for automation.

- Official **GitHub REST API** (no scraping).
- **Token discovery**: `--token``GITHUB_TOKEN``.secrets``gh auth token`.
- **Filters**: `--since`, `--assignee`, `--creator`, `--labels`, `--milestone`, `--state`.
- **Scopes**: owner/org scoping, or target a **single repo** with `--repo`.
- **Cross-repo “my issues”** (`--my-issues`) via `GET /issues`.
- **Output**: TXT + JSONL (disable JSONL with `--no-jsonl`).
- GitHub Enterprise via `--api-base`.

## Install (editable)

```bash
pip install -e .

Configure auth

Create a .secrets in repo root (ignored by Git):

GITHUB_TOKEN=ghp_your_token_here

Or export it:

export GITHUB_TOKEN=ghp_your_token_here

If neither is set and you use GitHub CLI, we’ll try:

gh auth token

Usage

All accessible repos:

gh-issues-export

Only your user’s repos:

gh-issues-export --owner your-login

Only a specific org:

gh-issues-export --org my-org

A single repo (recommended for precision):

gh-issues-export --owner my-login --repo my-repo
# or
gh-issues-export --org my-org --repo my-repo

Include PRs too:

gh-issues-export --include-prs

Filter examples:

gh-issues-export --since 2025-01-01 --labels bug,priority:high --assignee your-login

Cross-repo “my issues”:

gh-issues-export --my-issues --my-filter assigned --state open --since 2025-01-01

GitHub Enterprise:

gh-issues-export --api-base https://github.mycompany.com/api/v3

Pick output path:

gh-issues-export --outfile my_issues.txt

Logging and behavior:

gh-issues-export --verbose
gh-issues-export --continue-on-error
gh-issues-export --no-jsonl

Examples

Export a single public repo (this project’s author thenarfer / cloud-starter example):

gh-issues-export --owner thenarfer --repo cloud-starter --state all --outfile cloud_starter_issues.txt

Testing

This repo ships a sitecustomize.py that sets PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 so pytest won’t auto-load unrelated global plugins.

# Recommended: isolated env
python -m venv .venv && source .venv/bin/activate
pip install -e .[dev]
pytest

(Alternatively: PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest)

Notes on permissions

Use a fine-grained PAT with:

  • Issues: Read
  • Metadata / Repository: Read (For private/org repos, you may also need org-level access; classic PAT with repo read works too.)

License

License: MIT

About

Export GitHub issues to neat TXT + JSONL via the official REST API.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages