Marcus Anthony
Marcus Anthony

Reputation: 99

Github: Automerge immediately after a push and only for selected branches

I'd like to enable auto merge ONLY for dev->staging (i.e. merged from dev to staging branch) and immediately after someone pushes anything to dev. Because merges come from PR, this PR should also be automatically created. The solution should not require additional CI/CD software (e.g. Teamcity), but I'm OK to write some scripts, and should be integrated into Github.

So the process is: someone manually merges his feature branch into the dev branch. This is automatically captured and immediately a PR from dev to staging is created, some tests are run, and if all tests pass then the merge occurs automatically.

I looked at auto-merge in Github but it's too simple for my use case. I'm thinking about using Github Action but wondering if anyone has done something similar? Thanks!

BTW I'm OK if the second step (PR) has to be manually triggered, but I cannot use auto-merge for just one branch.

Upvotes: 2

Views: 1234

Answers (1)

VonC
VonC

Reputation: 1324606

The solution should not require additional CI/CD software (e.g. Teamcity), but I'm OK to write some scripts, and should be integrated into Github.

That kind of integration is called GitHub Actions and will use a workflow file that you put in your GitHub repository.

You can therefore adapt vsoch/pull-request-action, which can open a pull request to master branch (or otherwise specified) whenever a branch with some prefix is pushed to.
While it is not exactly your use case, you can fork that GitHub Action to make to do exactly what you need.

Upvotes: 1

Related Questions