-
Notifications
You must be signed in to change notification settings - Fork 304
Jira Integration
richardkchapman edited this page Oct 16, 2012
·
3 revisions
We're using a new bug-tracking system, Jira, here: http://track.hpccsystems.com
The GitHub pull request process is integrated with the Jira work-flow (request, pull, merge), and most of it happens automatically via external triggers.
But there is one thing that doesn't work like it used to in GitHub, the highlight of the issue names on pull requests. So we did a Grease Monkey script to simulate that.
Copy and paste the code below into your Grease Monkey (or Tamper Monkey in Chrome) and it'll automagically work after the first refresh.
// ==UserScript==
// @name HPCC Github to Jira
// @namespace http://hpccsystems.com/
// @description Turn references to HPCC issues into clikable links.
// @include http://github.*
// @include https://github.*
// ==/UserScript==
(function(){
var regex = /(HPCC|IDE|HH)-[0-9]+/g;
var black_tags = ["a", "script", "style", "textarea", "title", "option", "pre", "code"];
var path = ".//text()[not(parent::" + black_tags.join(" or parent::") +")]";
textNodes = document.evaluate(path, document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for(var i=0,item; (item=textNodes.snapshotItem(i)); i++){
var itemText = item.nodeValue;
if(regex.test(itemText)){
var span=document.createElement("span");
var lastLastIndex = 0;
regex.lastIndex = 0;
for(var myArray = null; myArray = regex.exec(itemText); ){
var link = myArray[0];
span.appendChild(document.createTextNode(itemText.substring(lastLastIndex, myArray.index)));
var href = "http://track.hpccsystems.com/browse/" + link,
text = link;
var a = document.createElement("a");
a.setAttribute("href", href);
a.appendChild(document.createTextNode(text));
span.appendChild(a);
lastLastIndex = regex.lastIndex;
}
span.appendChild(document.createTextNode(itemText.substring(lastLastIndex)));
item.parentNode.replaceChild(span, item);
}
}
})();