Skip to content

Instantly share code, notes, and snippets.

@felippenardi
Created January 18, 2016 16:39
Show Gist options
  • Save felippenardi/6e1c1599b96dcfa582c7 to your computer and use it in GitHub Desktop.
Save felippenardi/6e1c1599b96dcfa582c7 to your computer and use it in GitHub Desktop.
Pivotal Tracker Branch Naming Generator
javascript: (function ($) {
var storyTitles = [];
var story = $('.story .details').closest('.story').first();
if(story){
var title = story.find('.editor.name').val();
var id = /story_(\d+)/.exec(story.attr('class'))[1];
var storyType = story.find(".story_type .selection").text();
var gitptTitle = id + '-' + title;
var translate = {
"ä": "ae", "ö": "oe", "ü": "ue", "ß": "ss"
};
var cleanedTitle = storyType + "-" + gitptTitle.toLowerCase().replace(/[öäüß]/g, function(match) {
return translate[match];
}).replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-/, "").replace(/-$/, "");
prompt('Your branch name:', cleanedTitle);
} else {
alert("Please select the stories first.");
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment