Created
December 22, 2015 03:54
-
-
Save agate/defa31077a59bf5e81ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Github Issue Branch Name | |
// @namespace http://agate.github.com | |
// @version 0.1 | |
// @description Auto generate feature branch with issue's title | |
// @author agate | |
// @match https://github.com/*/*/issues/* | |
// @grant none | |
// ==/UserScript== | |
var $jqTitle = $('.gh-header-title'); | |
var title = $jqTitle.text(); | |
var branchName = title.split("\n").join(" ") | |
.replace(/\s+/g, " ").trim().toLowerCase() | |
.replace(/[^\w ]/g, ' ') | |
.replace(/\s+/g, '_') | |
.replace(/^_*/, ''); | |
$jqTitle.append('<span style="display: block; color: gray; font-size: 18px; font-weight: lighter; margin-top: 8px;"><strong>BRANCH NAME:</strong> ' + branchName + '</span>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment