Auto-approve force-pushes if PR was already approved

In our repository, the “Dismiss stale pull request approvals when new commits are pushed” option is enabled.

However, it often happens that you need to rebase your branch to the head of master, or maybe squash commits or change commit messages.  If you do this and then force-push to your branch, reviews are dismissed and you need to get a new review.

Is there a way to set up the repository such that force-pushes do not dismiss reviews as long as the code diff is the same?  If this option is not available in core GitHub, how could a webhook be set up to do it?

11 Likes

HI @sffc,

Thanks for taking the time to write about this behavior, currently there is not a setting on core to accomplish what you’d like; you might investigate using Probot to build an app that might be able to automate this.

We are always looking for ways to improve GitHub and you can rest assured I’ll take your feedback to the appropriate teams.

Best,

Andrea

@andreagriffiths11  You say:

… rest assured I’ll take your feedback to the appropriate teams.

Is this now on the roadmap for Github development? If so when is the expected implementation date?

5 Likes

Any news on this?

2 Likes

Also curious if there is any progress on this.

There are always a few small changes after a PR is approved, and right now any change (squash commits, change commit message, etc) will dismiss.

Would be better, as OP suggested, if this applied only when the diff changed.

2 Likes

Bumping this. I expect all my devs to rebase frequently, so dismissing approvals for code changes when the diff didn’t actually change seems counterproductive. This option is so close to what I typically want for my teams… force ALL code to be reviewed before merging (which is great for things like SOX compliance), but dismissing those approvals when the code didn’t actually change (just the history) prevents us from turning this on.

Without this option checked, we still have the problem of people force-pushing new code after the required approvals, and that new code will likely never be reviewed.

2 Likes

Bumping this too. Has anyone created a bot for this? To work around this I have to keep just one PR open at a time, make others draft PRs, then merge/rebase before opening then next PR. Otherwise approvals will keep getting dismissed and the repo owner requires approval. There should be an option to not auto-dismiss if the diff is the same.

1 Like

One thing you can do is message Github support about this. Ideally from multiple accounts/users, for example ask are your colleagues to ask for this (you can help them with a boiler-plate message to post to Github support).

1 Like

@sandstrom - to clarify, don’t message Support about this, message Product! :grin:

You can submit this through our official product feedback form so that our product team can track your request!

2 Likes

This is a major annoyance and would be so great to have.

1 Like

Bumping this to see if we can get on roadmap. A checkbox for not dismissing approvals when the diff is the same would save us hundreds of hours each year, not to mention the hassle of tracking down approvers sometimes for 2nd/3rd/4th times on some of our busiest repos.

1 Like

I personally would love to see this resolved quickly!

It is burning hours of dev time as well as already offered in competing tools.

Love to see GitHub stay on top of the game!

1 Like