Skip to content

Instantly share code, notes, and snippets.

@ajsharp
Created August 17, 2011 23:48
Show Gist options
  • Save ajsharp/1152944 to your computer and use it in GitHub Desktop.
Save ajsharp/1152944 to your computer and use it in GitHub Desktop.
DotJS script to create github issues from AirbrakeApp error pages
// 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