Created
March 9, 2018 01:25
-
-
Save knz21/2f6e1b42cac767239deb3b90402d6c32 to your computer and use it in GitHub Desktop.
Copy github commit messages.
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
var commits = ''; | |
Array.prototype.slice.call(document.getElementsByTagName('code')).filter(function (code) { | |
return code.children[0].classList.contains("message"); | |
}).forEach(function (code) { | |
var commit = code.children[0].text; | |
if (commit.indexOf('Merge') != 0) commits += commit + "\r"; | |
}); | |
var body = document.getElementsByTagName('body')[0]; | |
var span = document.createElement('span'); | |
span.textContent = commits; | |
body.appendChild(span); | |
var range = document.createRange(); | |
range.selectNodeContents(span); | |
var selection = window.getSelection(); | |
selection.removeAllRanges(); | |
selection.addRange(range); | |
document.execCommand('copy'); | |
selection.removeAllRanges(); | |
body.removeChild(span); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment