Created
August 17, 2011 23:48
-
-
Save ajsharp/1152944 to your computer and use it in GitHub Desktop.
DotJS script to create github issues from AirbrakeApp error pages
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
// NOTE: You need dotjs installed to use this: https://github.com/defunkt/dotjs | |
// | |
// You must name this file with your airbrakeapp subdomain prepended to the filename. | |
// Example: So myairbrakesubdomain.airbrakeapp.com.js | |
var login = "<GITHUB USERNAME>"; | |
var token = "<GITHUB TOKEN>"; | |
var title = $("#notice_heading h2").text(); | |
var link = document.location.href; | |
var button = $('<button id="create-github-issue">Create Github Issue</button>'); | |
button.appendTo("#resolved_toggle"); | |
button.click(function() { | |
var data = {"token": token, "login": login, "title": title, "body": link} | |
// prevent accidental double submission | |
button.attr("disabled", "disabled") | |
$.ajax({ | |
method: "POST", | |
data: data, | |
url: "https://github.com/api/v2/json/issues/open/REPO_USER/REPO_NAME", | |
success: function() { | |
button.html("Issue Created.") | |
var issueUrl = data['issue']['html_url'] | |
button.after('<a href="'+issueUrl+'" target="_blank">Go to Issue</a>') | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment