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.

Revisions

  1. electricg created this gist Feb 11, 2020.
    16 changes: 16 additions & 0 deletions merge.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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;