[HOW-TO] A complete issue workflow inside your IDE and GitHub

TL;DR – An overview of creating a continuous workflow using your IDE, ticket system and source repository to minimize overhead.

Minimizing overhead

At Fundbox, we really try to keep the overhead associated with managing the development cycle to a minimum. There are several cool things we do on this front, one of which is integrating our ticket system to our IDE and source repository, creating one streamlined workflow. This post will cover this setup, and will be the first in a series of posts covering working environment automation tips.

Tasks and Issues

The process of picking the next issue / task to work on can be time-consuming: there’s a lot of context switching involved, like accessing the issue tracker, picking a task, and marking it “In Progress”. Then, you switch back to the IDE and start working, “context-less”, perhaps remembering to write a commit message with the issue number once you’re done.

Having so many manual steps, this process is very prone to human error (e.g. forgetting to mark the ticket ID in the commit), and can be automated by linking the different steps in the workflow to one continuous chain:

  1. Connecting your IDE to your ticket system
  2. Making sure you reference the ticket ID  in the commit message
  3. Marking a “Fixed” issue directly from the commit message
  4. Connecting your git repository back to your ticket system

Connecting the IDE

Our team just loves PyCharm, and that’s what we use for development. For ticket management, we use YouTrack.

PyCharm (like all JetBrains IDEs) can be integrated with a variety of ticket systems (Jira, Trac, FogBugs, GitHub etc.).
To enable this integration, go to Settings -> Tasks -> Servers, click the + icon, and select your ticketing system.

tasks

Afterwards, just configure the correct URL, username and password, and hit “test”. If everything’s OK, you have successfully connected your IDE to the ticket system!

Proper commit messages

The above configuration dialog also allows you to define the search terms for tickets, and to customize the commit message.

This will allow the IDE to pre-populate your commit message with ticket id and a short description.

commit_message

As per the YouTrack REST API, we moved the summary before the ID, and prefaced the ID with a ‘#’. Other systems, such as Jira, may have their own formats, so just make sure the format you configure matches the commit message format in your ticket system.

Working on tasks

As I mentioned earlier, we do a lot of work to minimize context switching. One of the ways in which we accomplish this is to start working on tasks from inside the IDE, without having to switch back and forth between screens. This looks something like this:

issue_open

Aside from marking the ticket as “In Progress” (allowing your team to know what everyone’s working one), the dialog has a “clear context” option. This option will close every tab you have open, and give you a clean slate, improving focus. When you switch between issues, the IDE will maintain the correct context, saving and restoring the relevant files for each task.

Issuing commands via Commit messages

We use GitHub. One of the things that make GitHub awesome is that it provides service hooks to integrate with YouTrack (and almost every other ticketing system). This means that when there’s an update to the repository, the ticket system can receive a notification.

github_hooks

This integration means that you can use your commit messages to issue commands to your ticketing system!

To connect GitHub to your ticketing system, you need to make sure you use the same email in both systems, otherwise the commands will not execute (at least in YouTrack’s case).

After you successfully connected the two systems, making a commit with the message “Tweak header #FE-123 fixed” will mark Issue 123 in project FE as “Fixed”!

Recap

So to recap, you can set up your environment like so:

Ticket System -> IDE -> GitHub -> Ticket System

And then open, mark “In Progress” comment and “Fix” tickets right from the IDE interface.

Gimme more awesome!

In addition to the above, go to “Settings” -> “Version Control” -> “Issue Navigation” in your IDE and add your ticket system URL and regexp.

issue_navigation

This will scan commits in your git history, and, upon finding matching commit messages with the ticket ID, insert a link to your ticket system like so:

Commits with links screen

This will make “investigating” past code much easier. Making the relevant issue just one click away!

Fundbox helps small businesses to fix their cash flow by turning unpaid invoices into money in the bank. Apply now to start clearing your unpaid invoices.