Need to archive some repositories that are stored on GitHub? Great. Don't forget to hold on to any open issues you may still have. GitHub Issue Exporter is a command-line utility that will download all the open issues for a single repository.
There's also another executable for importing those issues back into a repository, so you can resurrect an archived repository with all of its issues.
GitHub Issue Exporter is built with Ruby and needs Ruby 2.0 or higher. Install it with RubyGems.
gem install github_issue_exporter
Some environments may require sudo
permissions.
sudo gem install github_issue_exporter
There are two executables, export-github-issues
and import-github-issues
. Both reneed at least three things to run, the owner of the repository, the repository name, and an access token that has the authority to download the Issues. You can generate this token from here, and clicking on "Generate new token". Here's a blog post with some more of the details involved.
The Exporter has a couple of options.
--multiple-files
By default Issue Exporter downloads and stores all the issues into a single JSON file. Setting the multiple-files
flag will create a separate file for each Issue.
--output
Set the directory to store the issues in. By default it is the current directory.
--output-type
Sets the filetype to output. Current options are file
(the default) and csv
. The multiple-files
flag will only work with file
.
--closed
By default, only Open issues are exported. Adding this flag will include Closed ones as well.
The issues will be exported into either a single issues.json
file or multiple issue-[NUMBER].json
files.
export-github-issues tallwave github_issue_exporter [TOKEN]
export-github-issues --closed tallwave github_issue_exporter [TOKEN]
export-github-issues --multiple-files --output ~/issues tallwave github_issue_exporter [TOKEN]
export-github-issues --output-type csv tallwave github_issue_exporter [TOKEN]
You can import issues a couple of different ways. First is to provide the name of each JSON file created by the exporter.
import-github-issues issues.json more-issues.json tallwave github_issue_exporter [TOKEN]
Or you can use the --directory
flag and load all the JSON files in the specified directory.
import-github-issues --directory ~/issues tallwave github_issue_exporter [TOKEN]
- Issues will be added to the repository as if they were brand new, so old issue numbers will not be used.
- If your user does not have push access to the repository, assignees, milestones, and labels will not be set. Read more in the GitHub documentation.
This sees sporadic development but here's some info if you're interested:
You'll need bundler installed. Run bundle install --binstubs
to install dependencies and test binaries. You can then execute the specs with bin/rspec
from the root folder.
- Better error handling.
- Properly import closed issues.
- Create a GitHub 'application' so that the user doesn't need the auth token.
- Fork
- Make it better
- Create a Pull Request