Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Reset approvals when source branch is modified and not PR rebased

sheshachandra_tumkur-prasanna February 19, 2025

Hi,

I want to reset the PR approvals when the sourceBranch is updated. Thought of doing it using the webhook "Source branch updated" event.

I noticed that clicking on the button "Rebase" in a pull request will trigger the same event as updating the source branch. We do not want to reset the approvals when the PR is rebased, but want to reset the approvals only when new commits are added to source branch. Is there a way to differentiate between these 2 events ? 

I have tried using script runner but since the events are same, I couldn't differentiate between them. 

All ideas are welcomed. Thanks in advance. 

1 answer

0 votes
Ulrich Kuhnhardt _IzymesCo_
Atlassian Partner
February 26, 2025

Hi Sheshachandra,

I understand that you are syncing the pull request source branch with the target branch, while a PR is in progress and approvals have already been submitted.

... And you are correct, since rebasing is not an effective code change, why are approvals revoked?

From the Git point of view it is much easier to detect branch sync via _merge_, where you _merge_ the target branch into the source branch.

Workzone (one of our apps) allows you to keep PR approvals on sync _merge_ (not rebase). You can configure this repo or project wide in Workzonen properties (#3).

I agree, keeping approvals after branch sync is a massive time-saver for your teams, that's why we added this option.

Let me know if you need any help setting this up. There's also a demo instance with Workzone so you can have a look around and try it out.

In conclusion, there is an option to keep approvals after branch sync if you use _merge_ sync (instead of rebase) and give Workzone a go.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Upcoming Bitbucket Events