Skip to content

Instantly share code, notes, and snippets.

@mihneadb
Created May 20, 2014 12:29
Show Gist options
  • Save mihneadb/2c4ef6a9ee0e2c092ea3 to your computer and use it in GitHub Desktop.
Save mihneadb/2c4ef6a9ee0e2c092ea3 to your computer and use it in GitHub Desktop.
github api demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h3>GH Issues</h3>
<p>For facebook/react, only issues with label "build/tooling".</p>
<ul id="issues">
</ul>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
var owner = 'facebook';
var repo = 'react';
var since = new Date(2014, 0);
var API_BASE = 'https://api.github.com';
var ENDPOINT = API_BASE + '/repos/' + owner + '/' + repo + '/issues';
var options = {
state: 'closed',
labels: 'build/tooling',
sort: 'updated',
since: since.toISOString()
};
$.get(ENDPOINT, options)
.done(function (data) {
data.forEach(function (issue) {
var labels = issue.labels.map(l => l.name).join(', ');
var item = $('<li>' + issue.title + ' -- ' + labels + '</li>');
$('#issues').append(item);
});
})
.fail(function (err) {
console.log(err);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment