Last active
December 27, 2015 10:09
-
-
Save gr2m/7309560 to your computer and use it in GitHub Desktop.
get all commits from one GitHub organization using jQuery
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
var org = 'hoodiehq'; | |
var sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(); | |
$.getJSON('https://api.github.com/orgs/'+org+'/events').then( function(events) { | |
var commits = []; | |
events.forEach( function(ev){ | |
if (ev.created_at < sevenDaysAgo) return; | |
if (ev.type !== 'PushEvent' || ! ev.payload.commits) return; | |
ev.payload.commits.forEach( function(commit) { | |
commits.push(commit.author.name + ': ' + commit.message.split(/\n/)[0]) | |
}) | |
}); | |
console.log(commits.join('\n')) | |
} ) |
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
Alex Feyerke: Built sponsoring change | |
Atul Varma: Remove empty parenthesis. | |
Jan Lehnardt: Merge pull request #37 from toolness/gh-pages | |
Alex Feyerke: Built sponsoring change | |
Atul Varma: minor typo fixes to index.html. | |
Jan Lehnardt: Merge pull request #36 from toolness/gh-pages | |
Alex Feyerke: Built another sponsoring change | |
Jan Lehnardt: 1k | |
Alex Feyerke: Built sponsoring change | |
Jan Lehnardt: human js | |
Sven Lito: [fix] remove unnecessary semicolon | |
Sven Lito: [test] adds more tests | |
Sven Lito: [feature] adds verbose flag to install/uninstall commands | |
Sven Lito: fixing tests | |
Sven Lito: update verbose branch | |
Sven Lito: [fix] make tests pass | |
Sven Lito: [minor] remove reference to old hoodie-app directory | |
Sven Lito: [minor] readme tweaks | |
Sven Lito: Merge branch 'dev' of https://github.com/hoodiehq/hoodie-cli into dev |
to bump the request limit from 60 to 5000 / hour, pass username & password ...
var org = 'hoodiehq';
var username = 'myusername';
var password = 'secret';
var get = function(path) {
return $.ajax({
url: 'https://api.github.com' + path,
headers: {"Authorization": "Basic "+ btoa(username+':'+password) }
})
}
get('/orgs/'+org+'/repos').then( function(repos) {
var promises = repos.map( function(repo) { return get('/repos/hoodiehq/'+repo.name+'/commits') })
$.when.apply($, promises).then( function() {
var reposCommits = Array.prototype.slice.call(arguments);
reposCommits = reposCommits.map( function(args) { return args[0]})
console.log(reposCommits)
})
})
nice!
nice one!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a script that loads commits from all repos from a github org, but beware of the API request limits ...