Coder Social home page Coder Social logo

fiorisi / gh2md Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mattduck/gh2md

0.0 0.0 0.0 351 KB

Export Github repository issues and pull requests to a single, readable markdown file

License: MIT License

Makefile 9.31% Python 86.93% Shell 3.76%

gh2md's Introduction

gh2md

PyPI Travis

Dump issues and pull requests for a Github repository into a single, readable markdown file.

There are various other projects that handle Github issue exports (Eg. offline-issues), but I couldn't find one that writes all issues, comments and metadata to a single readable file.

Example exports

An example exported file is included in the examples directory.

Default behaviour is to export all issues and open PRs. Closed PRs are ignored.

Github workflow: backup issues as a markdown file in your repo

@0ut0fcontrol contributed a github workflow that uses gh2md to run a nightly export to issues.md, and push it back to your repo. You can find the thread and workflow code here.

This has been added to the gh2md repo itself, so you can see an up-to-date export in issues.md.

Usage

Run export for pope/ob-go, prompting for login to mygithubuser:

gh2md pope/ob-go ob-go.md --login mygithubuser

Run export for sarabander/sicp, passing in token:

gh2md sarabander/sicp sicp.md --token myAPItoken

Run export for paulirish/git-open, pulling token from environment, and excluding closed PRs:

export GITHUB_ACCESS_TOKEN=myAPItoken
gh2md paulirish/git-open git-open.md --no-closed-prs

Run export for shezadkhan137/required, pulling token from file, and excluding closed issues::

echo myAPItoken > ~/.github-token --no-closed-issues
gh2md shezadkhan137/required required.md

Full help:

usage: gh2md [-h] [-l LOGIN_USER] [-t TOKEN] [-I] [--no-prs] [--no-closed-prs]
            [--no-issues] [--no-closed-issues]
            repo outpath

Export Github repository issues and comments into a single
markdown file. https://github.com/mattduck/gh2md.

Example: gh2md mattduck/gh2md my_issues.md

Credentials are resolved in the following order:

- The --login flag always takes precedence and will prompt for this user.
- The --token flag.
- A `GITHUB_ACCESS_TOKEN` environment variable.
- An API token stored in ~/.github-token.

positional arguments:
repo                  Github repo to export, in format "owner/repo_name".
outpath               Path to write exported issues.

optional arguments:
-h, --help            show this help message and exit
-l LOGIN_USER, --login LOGIN_USER
                        Prompt to login as this Github user. If provided, this
                        takes precedence over any token found in the
                        environment. If not provided and no token is found,
                        you will be prompted to login as the repository owner.
-t TOKEN, --token TOKEN
                        Automatically login with this Github API token. If
                        --login is provided, this is ignored.
-I, --idempotent      Remove non-deterministic values like timestamps. Two
                        runs of gh2md will always produce the same result, as
                        long as the Github data has not changed.
--no-prs              Don't include pull requests in the export.
--no-closed-prs       Don't include closed pull requests in the export.
--no-issues           Don't include issues in the export.
--no-closed-issues    Don't include closed issues in the export.

Install

pip install gh2md. Alternatively, clone the repository and run make install.

TODO

  • Improve performance. Currently fetching issues using PyGithub is slow - I assume it's possible to bulk-fetch most of the data.
  • Add flag to toggle inclusion of images.
  • Support 2FA login - currently if 2FA is enabled on your account you must setup an access token.

gh2md's People

Contributors

0ut0fcontrol avatar actions-user avatar mattduck avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.