Site icon Eitan Blumin's blog

Import GitHub Issues from Trello Cards using Powershell

I know this has little to do with SQL Server (and therefore, not quite like me to post this), but it’s a nifty little script in Powershell which I’ve been working on recently, and I believe other people may find use for it as well (someone, somewhere, maybe?).

This script basically takes a Trello JSON file (created using their Export feature), connects to a GitHub repository, and creates one GitHub issue per each Trello card. Any labels are copied over, any checklists in the Trello card will be added into the issue body as checklists, and any attachments in the Trello card will be added into the issue body as an unordered list of links. Finally, at the bottom of the issue’s body there would be a link back to the original Trello card.

The Script

First of all, without any further ado, you may find the aforementioned Powershell script in my GitHub Gists here:

Instructions

See below the steps you’d need to take in order to make use of the script:

1. Export your Trello board

First we need to get our hands on a JSON file containing all of your Trello board data.

1.1. Go to your Trello board, and click on the “Show Menu” button on the right (fig. 1)

fig. 1

1.2. Then, click on “… More” (fig. 2)

fig. 2

1.3. Click on “Print and Export” (fig. 3)

fig. 3

1.4. Click on “Export as JSON” (fig. 4)

fig. 4

1.5. You will get a JSON file representing your entire Trello board. Save it in an accessible path on your computer.

2. Get your GitHub personal access token

In order to be able to connect to your GitHub repository using Powershell, we’d first need to generate a personal access token. Click here for the GitHub’s instructions page for generating personal access tokens.

In short:

Log into GitHub, [1] click on your Profile pic, [2] click on Settings, [3] click on “Developer Settings” on the left-hand menu, [4] click on “Personal access tokens”, and then [5] click on “Generate new token” (fig. 5)

fig. 5

Give a description to your new token, and give it the “repo” permission scope (fig. 6)

fig. 6

Once you click on the green “Generate token” button, you’d be presented with the token string. You must copy it and save it somewhere safe, because you won’t be able to get it again from GitHub without creating a new token.

3. Run the Script

That should be enough preparation. You can now start running the Powershell script.

The script accepts the following mandatory parameters:

There are also a few optional parameters:

4. See the magic happen

That’s it! Once you’ve completed all preparations and set up all parameters properly, you should be able to run the script, sit back and enjoy the show, while your GitHub issues pile up.

fig. 7
example issue imported from Trello using the script

Conclusion

Note that any unicode text would have to be converted to ASCII, so if you have Unicode characters in your Trello cards, they may look a bit different by the time they reach GitHub.

After importing all the Trello cards as issues, you can start using the labels to make it easier for you to further organize your issues: Filter by labels to easily set assignees, milestones, and/or add to projects.

Something doesn’t work? Got questions or comments? Or just feel like praising the free fruits of my hard labor? Leave a comment below!

Exit mobile version