Skip to content

Instantly share code, notes, and snippets.

@keymon
Last active August 12, 2016 09:00
Show Gist options
  • Save keymon/aa314cdc0b89dc1b62b73fd208385404 to your computer and use it in GitHub Desktop.
Save keymon/aa314cdc0b89dc1b62b73fd208385404 to your computer and use it in GitHub Desktop.
Userscript to disable the Merge button inside pull requests on certain github projects
// ==UserScript==
// @name Hide GitHub Merge Button
// @version 0.4
// @description Removes the merge button on a GitHub project, so you will remember to
// rebase/write a useful merge message.
// @match https://github.com/alphagov/paas-cf/pull/*
// @grant GM_addStyle
// ==/UserScript==
var main = function () {
var clearMergeButton = function() {
document.querySelector('.js-merge-branch-action').style.display = 'none';
};
setTimeout(clearMergeButton, 500);
// Merge button gets reset after you add a comment for some reason, so hide it then too
form = document.querySelector('form.js-new-comment-form')
form.addEventListener('submit', function() { setTimeout(clearMergeButton, 1000); });
};
main();
@keymon
Copy link
Author

keymon commented Jun 8, 2016

You can use this user-script by:

  1. Installing a userscript plugin:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment