A LINQPad script to migrate issues from Bitbucket to a GitHub repository.
- Imports the issues, comments, and actions from the original bitbucket issues
- Closes issues that were marked closed it bitbucket (or marked duplicate/invalid/etc.) - configurable
- Allows replacing users with the corresponding github users
- Note: all actions will be added to github as being created the github user running the script - however text/comments are added to denote who originally created the issue/comment.
What does the end result look like? Take a look at NUnit.ApplicationDomain early issues, specifically as an example, see issue #1
- Does not import attachments or images; PRs welcome
Here's a warning:
It's highly suggested that you test importing into a scratch/private repository before importing into a live repository; this will allow you to verify it works and adjust as needed before performing the final import
- Export the issues from Bitbucket repository into a json file
- Navigate to the repository settings
- Navigate to
Import & export
under theIssues
section in the sidebar - Click
Start Export
- When it's completed, download the zip, and extract the files to a known location
- If you don't already have LINQPad installed, go install it; it's free and a great tool for .NET developers
- Download the
ImportFromBitbucket.linq
script in this repository - Open the script in linqpad
- Configure the script as needed (see below)
- Run the script using
F5
or the green play button
Most of the configuration is straightforward - you'll need:
- the path to the exported bitbucket json (in 2.0 format)
- the name of the owner of the github repository
- the name of the github repository
- the url of the original bitbucket repository - to enable links back to the original
Additionally, you'll need a personal access token; this isn't specified in the script - it's retrieved via Util.GetPassword
- but LINQPad will prompt you for it. You can create a token via the Personal access tokens page on github; feel free to delete the token after you're done importing.
Since all issues are created from the account of the personal-access-token, you may wish to create a secondary "machine account" for the purposes of importing issues; per the link provided, this is totally okay by GitHub, and IMHO makes it much more clear that the issue was imported rather than native.
GitHub only has open or closed issues, while bitbucket has much more rich statuses like "duplicate", "invalid" etc. You can specify the statuses that indicate that an issue is "closed".
The original author of an issue/comment/action is listed in each comment. By default the original author's display name is set as the author; for example if I had commented on an issue, it would show up as "Mackenzie Zastrow commented". If you instead want to map "Mackenzie Zastrow" to @zastrowm", you can do that using the userMapping
dictionary, after which, the text would show up as "@zastrowm commented".