sindresorhus/refined-github

Enable Auto Merging PRs when status checks are required. #1325

pgrm posted onGitHub

This is a follow up to #865 and #975

If a branch is protected and has the flag Require status checks to pass before merging enabled, then I don't see how I could use the existing feature.

image

Because until those checks aren't successful, I just see a grayed out button and can't press anything:

image

It would be awesome, if there would be another button (created by this extension) next to it, to merge as soon as all checks have passed.


To add this feature, we'd have to recreate the whole form, including the logic between merging types. Additionally, we can't know which merging types are available (e.g. a repo only allows Squashing). Sounds impossible 🙁

I think you should ask GitHub to implement our wait-for-build feature (regardless of this requirement)

https://github.com/contact

posted by fregante about 5 years ago

fwiw this works for me as a browser snippet

function autoMerge() {
    const btn = window.$$('button').filter(el=>el.innerText === 'Merge pull request')[0]
    if (btn) {
        btn.click()
        const btn2 = window.$$('button').filter(btn=>btn.innerText === 'Confirm merge')[0];
        if (btn2) {
            btn2.click()
            return
        }
    }
    setTimeout(autoMerge, 1000)
}
window.$$ = $$;
autoMerge();
posted by gunar-gessner-qatalog about 5 years ago

That only works if you're fine with the default commit title and message. It's a good workaround but probably most people would expect to be able to preview/edit them.

Thank you for posting it!

posted by fregante about 5 years ago

@fregante can you add a little message next to the merge button that explains why the feature isn't working? I thought there was an issue with GHR originally

posted by graingert over 4 years ago

this is now a built-in feature:

https://github.blog/2020-12-08-new-from-universe-2020-dark-mode-github-sponsors-for-companies-and-more/

Auto-merge pull requests (https://github.com/github/roadmap/issues/107): when using protected branches. Rolling out over the next couple of weeks, enabled in your repo settings.

posted by graingert over 4 years ago

Thanks for the update!

That’s completely different from “Auto-merging” as intended by this extension (i.e. the user still has to click Merge whereas GitHub’s new feature will be completely automatic) but it’s probably what most people are after 🎉

posted by fregante over 4 years ago

That’s completely different from “Auto-merging” as intended by this extension (i.e. the user still has to click Merge whereas GitHub’s new feature will be completely automatic)

this isn't true. You still have to tick the "merge when pipeline passes" checkbox

posted by graingert about 4 years ago

Indeed, I think that changed since it came out of beta.

Too bad GitHub decided to make this a per-repo option rather than just allowing it on every repo like Refined GitHub does.

posted by fregante about 4 years ago

@fregante perhaps GitHub refined should automatically enable this feature on all repositories the user has access to on first install?

posted by graingert about 4 years ago

That's not something the extension should do. A cli tool would be better suited to do batch changes across multiple repos.

posted by fregante about 4 years ago

Fund this Issue

$0.00
Funded

Pull requests