-
-
Save cordoval/8049679 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 Adds Labels on Github Pull Request | |
// @namespace http://fabien.potencier.org | |
// @include https://github.com/*/*/pulls* | |
// @version 2 | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// ==/UserScript== | |
$(function() { | |
$(".pulls-list .list-group-item h4").each(function() { | |
var pull_request = this; | |
$(pull_request).addClass("issues-list"); | |
var issue_href = $("a:first", pull_request).attr("href").replace('/pull/', '/issues/'); | |
$.getJSON("https://api.github.com/repos" + issue_href + "?access_token=YOUR_API_TOKEN", function(issue) { | |
$.each(issue.labels, function(l_i, label) { | |
var label_html = $('<span class="labels"><span style="background-color: #' + label.color + ' !important; color: #333 !important" data-name="' + label.name + '" class="label">' + label.name + '</span></span>'); | |
$(pull_request).append(label_html); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment