Thursday, March 29, 2018

Small helper for Mac OS/X to open Jira items

In our Kiali project we develop at GitHub, but have the issue tracker on a Jira instance.

Developers put the jira ticket number into commit comments and pull-request headers. To see the Jira item I had so far to go to the Safari url bar and type in the issue link. Sometimes there was a different item already in the history, so I only had to change the key. But all in all that was tedious.

Luckily OS/X has tools like Automator, that allow to create your own services.

I launched Automator and selected to create a service. For details about this see this article.

I then put a "Execute AppleScript" action into the Automator workflow

automator workflow

Saving this whole workflow under "Open in JBoss Jira" then makes the service immediately available

So I can now select a Jira-key and do right-click to get the service

My service in the service context menu

Obviously the service is very much tailored to my need, so I'll put the AppleScript here so you can copy & modify it to your needs.

on run {input, parameters}
	set target to "https://issues.jboss.org/browse/" & (input as string)
	tell application "Safari"
		activate
		tell window 1
			set current tab to (make new tab with properties {URL:target})
		end tell
	end tell
end run

[ UPDATE ]
My colleague Max Andersen pointed out an even better way of doing this by having some helpers turn those keys into links that can directly be clicked.