Skip to content

Instantly share code, notes, and snippets.

@cdl
Created August 21, 2015 18:22
Show Gist options
  • Save cdl/854c42f5ec908a048290 to your computer and use it in GitHub Desktop.
Save cdl/854c42f5ec908a048290 to your computer and use it in GitHub Desktop.
// Snippet for extracting PR titles and links from a Github "compare" page
// Useful for creating changelogs!
var output = [];
var links = $('.issue-link');
if(!window.location.href.indexOf('github.com')) { alert('Not a Github compare page!'); }
links = Array.prototype.slice.call(links);
links = links.filter(function(link){
return link.innerText.match(/^#/);
});
links.forEach(function(link) {
var text = ['-'];
var pullLink = $(link).attr('href');
text.push('[' + link.innerText + '](' + pullLink + ')');
text.push(link.title);
output.push(text.join(' '));
});
console.log(output.join('\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment