Make auto PR to new branch if specified branch is changed

All,

I’m not quite sure how to say what I want to do here but I’ll try in words. On a repo I work on we have a main and develop branch and we do most of our PRs on develop. Once that is in good shape and validated, we do a PR of develop onto main and make a release.

But, we are now embarking on a pretty big refactor of our code but we need to be careful, so we are making a new branch off of develop, let’s call it refactor for lack of a good name.

Now, we want our developers whenever they do a PR for new-feature into develop and it’s merged, immediately after that they do a PR of develop into refactor so we don’t miss development. But to me this seems like something a GitHub Action could do. Sort of an "If merge into develop, make PR to refactor".

Is this doable with GitHub Actions? I am looking through the marketplace but, well:

666 results for “pull request” filtered by Actions

:slight_smile: A few to look through…

Well, I guess I can reply to myself. I found a cool action by @ChristophShyper that seems to do what I want: GitHub - devops-infra/action-commit-push: GitHub Action that will create a new commit and push it to t

Using that I was able to make an action such that:

on:
  push:
    branches:
      - develop

jobs:
  pull_request:
    name: Create Pull Request
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Run the action
        uses: devops-infra/action-pull-request@v0.4

On our repo develop is a protected branch, so I figured any push to it is a merge!