Automating Github & Jira Workflows with “Merge Assistant”

Nicolai Trandafil
Ellation Tech
Published in
3 min readDec 15, 2017

Boilerplate beginning

In computer programming, boilerplate code or boilerplate refers to sections of code that have to be included in many places with little or no alteration. It is often used when referring to languages that are considered verbose, i.e. the programmer must write a lot of code to do minimal jobs. [wiki]

Every company has guidelines how to do a high quality job, quickly and well documented. The last point is really important when we are talking about teamwork and IT companies. This criteria's push us to the next conclusion:

“We have to follow a set of rules”.
When you are doing a job once then twice using the same rules it becomes a boilerplate job. In fact, the real problem of the boilerplate job is not in that this job is boring but in our brain capability to make boilerplate jobs automatically and this sometimes gives us unexpected results.

Why merge assistant

Being a developer you have to resolve tasks, in our case we are working with ‘Jira’ task board and Github version control repository. When you fixed task you are going to create the pull request on Github. For pull requests we have a specific template here it is :

Jira: [ticketID](baseUrl.com/ticketID)
Reviewers: @reviewer1, @reviewer2 …

Synopsis

Changelog

How to Test

Wiki

When you specified all these fields starting code review and when you achieved approve to merge, then starts interesting part:
1) You open the previous commit in develop branch and copy commit message

Jira: {{ jiraTicket }}
Reviewers: {{ reviewers | join }}
PR: GH-{{ prNumber }}

2) You put your ‘JiraTicketID’ and Github pull request number.

3) And the most interesting part reviewers. The major part of Github users have nicknames which are not equal to ‘first.lastname’, but in our company we have requirement specify firstName.lastName, for instance, you have 3 reviewers and you need find their full names in Github profile or in slack, not so fast as we planned just to push the button merge…

4) Next small boilerplate step doesn’t forget to move ‘Jira’ ticket from Needs Review — > Dev complete column,

This repeated steps we have to do for every Github pull request, and if you have around 2-3 pull requests per day after a short period of time you will do this steps automatically with a big probability to make mistake.

How to configure
Merge assistant this is chrome extension which solves problems mentioned above, extension generates for you commit message with correct reviewers list and moves Jira ticket to the ‘Dev complete’ column.

First of all, you need to open the Github repository and clone ‘Merge Assistant’
here is the link: https://github.com/CCristi/GitPR.
Then run in terminal

  1. Run npm install
  2. Run npm run build
  3. Setup chrome extension to push code from /dist folder @link

After installation you will have extension in chrome then you need to configure ‘Merge Assistant’. Tap right click to the ‘Merge Assistant’ in the drop down appeared select options and you will see options page:

After configuration, tap to save button and you are done.

How it works
Open Github pull request click to button ‘squash and merge’ and then: left click to the ‘Merge Assistant’ it will generate commit message and will ask if you want move ‘Jira’ ticket to the ‘dev complete’. Here the demo:

Big thanks to VRV web team for testing this extension and special thanks to the main contributor Cristian Covali.

--

--