policy-bot icon indicating copy to clipboard operation
policy-bot copied to clipboard

ignore_update_merges for rebases

Open KnisterPeter opened this issue 3 years ago • 1 comments

Could the ignore_update_merges option be extended to ignore rebases which do not change any diff while rebasing? This would greatly help to keep approvals if a PR gets outdated by target branch updates.

KnisterPeter avatar Jul 24 '20 13:07 KnisterPeter

I don't think this is something we can easily support given the current architecture. ignore_update_merges uses a cheap heuristic that only works for merge commits created in the UI as a way to avoid expensive API calls to list and compare commit tress. To support rebases, I think we'd have to:

  1. Track pull request state to record both the old head SHA and the new head SHA after a rebase and force push. Policy Bot is currently stateless and I'm not sure if the GitHub API has a reliable way to look up the before and after state of a PR that was force pushed.
  2. Compare the trees of the new and old commits to determine if any files in the PR changed.

That said, it's possible that there's a clever and cheap way to detect safe rebases that I haven't thought of yet.

bluekeyes avatar Jul 27 '20 19:07 bluekeyes