Blog : Suit My Mind - Software that suits you

[updated] Move your tickets from Lighthouse to Github

Github has recently released an integrated issue tracking system which looks very promising. They also updated their API (which now has an Issus API section).

I decided to quickly write a small script that allows you to migrate your tickets from Lighthouse to the new GitHub issues tracker. This script will :

  • search for open tickets in your Lighthouse project
  • create a new issue for each Lighthouse ticket in your Github project
  • apply the following labels to the each newly created Github issue :
    • the corresponding Lighthouse ticket tags
    • the corresponding Lighthouse ticket milestone
    • the corresponding Lighthouse ticket assignee
    • the corresponding Lighthouse ticket state
    • a "from-lighthouse" label

Each newly created Github issue will also have a direct link to the corresponding Lighthouse ticket in its body.

Since the Github API does not currently allow to create issue comments, the Lighthouse ticket comments will simply be added in the Github issue's body (with some basic formatting to distinguish them from the initial ticket's body). [1]

This script needs the Lighthouse-api gem to be installed :

$ gem sources -a http://gems.github.com
$ sudo gem install Caged-lighthouse-api

Then, just download my script from here :

http://github.com/suitmymind/lighthouse-to-github/tree/master

$ git clone git://github.com/suitmymind/lighthouse-to-github.git

It is fairly easy to use and easy to configure, you'll find the following lines at the beginning of the script :

# -------------------------
# --- Lighthouse configuration
LIGHTHOUSE_ACCOUNT      = 'YOUR_ACCOUNT_NAME'
LIGHTHOUSE_API_TOKEN    = 'YOUR_API_TOKEN'
LIGHTHOUSE_PROJECT_ID   = YOUR_PROJECT_ID
LIGHTHOUSE_TICKET_QUERY = "state:open"

# -------------------------
# --- Github configuration
GITHUB_LOGIN      = "YOUR_ACCOUNT_NAME"
GITHUB_API_TOKEN  = "YOUR_API_TOKEN"
GITHUB_PROJECT    = "YOUR_GITHUB_PROJECT_NAME"

That's all you need to configure. You'll learn how to get your Github token here, and how to get your Lighthouse token here. To find your Github project name, have a look at your Github URL :

http://github.com/suitmymind/ubuntu-machine/tree/master

Here 'ubuntu-machine' is the project name (it seems that Github project name with a dot in the name do not work for the moment).

To find your Lighthouse account name and project ID, just have a look at a Lighthouse URL :

https://suitmymind.lighthouseapp.com/projects/22483-ubuntu-machine/overview

Here 'suitmymind' is the account name, and '22483' is the project ID.

When you have downloaded and configured the script, all you have to do is to run :

$ chmod 0755 migrate-lh-to-gh.rb
$ ruby migrate-lh-to-gh.rb

It can take quite a long time denpending on the number of tickets you have to migrate.

The script is surely not perfect, but I hope I can improve it with your feedback.

Feel free to improve this script or to post bug reports. Your feedback is more than welcome.

I hope you'll find it useful!

[update 1] : the Github API now allows to create comments, so Lighthouse comments are now migrated to Github comments.

[update 2] : some more improvements and bugfixes :

  • the number of attachements in Lighthouse is now specified in the Github ticket's body
  • the dot (.) in label names is converted as •, since I cannot manage to create labels with dots through the API
  • there is a distinction for 'special' labels :
    • LH milestones now begins with |M| (e.g. : '|M| 0.7')
    • LH states now begins with |S| (e.g. : '|S| assigned')
    • LH assignees now begins with @ (e.g. : '@Thomas Balthazar')
    • LH tags that begins with @ now begins with #, to avoid confusion with the @assignee convention)