Created
December 10, 2013 08:50
-
-
Save fabpot/7887553 to your computer and use it in GitHub Desktop.
Displays pull requests labels on Github. Change 'YOU_API_TOKEN' to a Github token or remove the query parameter altogether (but you will run out of calls very fast).
This file contains 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
@cordoval, I see you also liked this one. Thanks to @stof for sharing it and to @fabpot for creating original version.