Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

python-mario/auto_merge_my_pull_requests

Open more actions menu
 
 

Repository files navigation

Auto merge my pull requests

A GitHub Action to automatically merge pull requests on my repositories if:

  • I opened the PR
  • The test suite is passing
  • I haven't marked the PR as a WIP

After the PR is merged, it deletes the branch to keep things neat and tidy.

Motivation

I have a bunch of repos where I'm the only contributor, and I want to merge pull requests as soon as tests pass. (The repo with my blog, for example.)

This Action saves me the work of actually pushing the button, and means they get merged a little faster.

The Action is defined in a separate repo that doesn't have auto-merging pull requests so that somebody can't merge a PR with malicious code by editing the underlying Action.

Usage

Fork this repo, add your own rules in merge_and_cleanup_branch.py.

Reference the Action in your .workflow file:

workflow "merge_and_cleanup" {
  on = "pull_request"
  resolves = ["when tests pass, merge and cleanup"]
}

action "when tests pass, merge and cleanup" {
  uses = "yourname/auto_merge_my_pull_requests@development"
  secrets = ["GITHUB_TOKEN"]
}

Limitations

  • This will only merge pull requests which I opened. If you use this Action unmodified, you'll grant me magic PR-merging powers.

  • I'm only using this on repos that have a single test task. So it can handle this:

    but it gets confused by this:

    It will try to merge the pull request as soon as one of those checks completes. I only have a single task on each of my repos, so that's fine for me -- something like the check_suite trigger is probably more appropriate for larger builds.

License

MIT.

About

A GitHub Action for automatically merging my pull requests on personal repos

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.