Last active
April 21, 2016 12:49
-
-
Save raveren/f08ba2673a92c582692e1a233621762f to your computer and use it in GitHub Desktop.
[userscript] GitHubFlow PR merge idiot-proofing
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
// ==UserScript== | |
// @name GitHubFlow PR merge idiot-proofing | |
// @namespace https://gist.github.com/raveren/f08ba2673a92c582692e1a233621762f | |
// @version 0.3 | |
// @author raveren | |
// @description Confirmation before common mistakes when merging Pull Requests in github | |
// @match https://github.com/*/pull/* | |
// ==/UserScript== | |
(function() { | |
document.querySelector('.js-merge-branch-action').addEventListener('click', function(e){ | |
if ( document.querySelector('#commits_tab_counter').innerHTML.trim()!='1' | |
&& !confirm('More than one commit, you still wanna merge?')) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
return false; | |
} | |
if ( document.querySelector('.text-pending') && !confirm('Build not complete yet, you still wanna merge?')) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
return false; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment