create-pull-request icon indicating copy to clipboard operation
create-pull-request copied to clipboard

`This branch is out-of-date with the base branch` - warning from github

Open paymog opened this issue 4 months ago • 1 comments

Here's my workflow

name: Auto PR from dev to prod

on:
  push:
    branches:
      - dev

jobs:
  check-and-create-pr:
    runs-on: blacksmith-2vcpu-ubuntu-2204
    steps:
      - uses: actions/checkout@v4
        with:
          ref: prod
      - name: Reset promotion branch
        run: |
          git fetch origin dev:dev
          git reset --hard dev
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6
        with:
          branch: prod-promotion
          delete-branch: true
          title: "Auto PR: Merge changes from dev to prod"
          body: "This pull request has been automatically created to merge changes from the dev branch into the prod branch."

I'm using this on a terraform repo. The idea is that when a developer merges into the dev branch, a new PR is opened to merge into the prod branch. It overall works great, but when the auto PR is opened, I see the following from github which then affects our ability to merge without triggering an audit log

Image

Whats the correct way to avoid this issue?

paymog avatar Sep 11 '25 19:09 paymog

Hi @paymog

In my experience that GitHub message just means that some other commit landed in prod after the prod-promotion branch was created. Presumably, you have a rule set on the repository to make sure that all pull requests are up-to-date before merging. So the resolution would be to click Update branch, wait for the checks to pass, and then merge.

Am I misunderstanding the situation?

peter-evans avatar Dec 02 '25 20:12 peter-evans