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
// A snippet using the github public api to get | |
// the url and sha of the first commit for a given repo | |
function openFirstCommit(userorg, repo) { | |
return fetch('https://api.github.com/repos/'+userorg+'/'+repo+'/commits') | |
// the link header has additional urls for paging | |
// parse the original JSON for the case where no other pages exist | |
.then(res => Promise.all([res.headers.get('link'), res.json()])) | |
.then(([link, commits]) => { | |
if (link) { |