Skip to content

Instantly share code, notes, and snippets.

@electricg
Created February 11, 2020 22:35
Show Gist options
  • Save electricg/9ad679c5ff40cb2d3365af54d9020ec5 to your computer and use it in GitHub Desktop.
Save electricg/9ad679c5ff40cb2d3365af54d9020ec5 to your computer and use it in GitHub Desktop.
Extension to detect the type of merge based on the base branch
const options = {
master: 'merge',
staging: 'squash'
};
const base = document.querySelector('#partial-discussion-header .base-ref').textContent.trim();
const what = options[base];
[...document.querySelectorAll('button[data-details-container=".js-merge-pr"]')].forEach(item => {
item.disabled = true;
});
document.querySelector(`.select-menu-merge-method button[value="${what}"]`).click();
document.querySelector(`button[data-details-container=".js-merge-pr"][class*="${what}"]`).disabled = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment