palantir/policy-bot

Seeing "Approved" status label with one approval when requires.count > 1

azanli opened this issue · 2 comments

On the main "Pull requests" page, we're seeing the "Approved" status label being applied to PRs that are still missing one more approval required for merging.

approved PR label

Although this label does not change the fact that policy-bot still requires one more approval before merge conditions are met, it can be misleading at a cursory glance. Prior to switching over to policy-bot, the Github branch protection rule for the required number of approvals would correctly set the label to "Approved" only after the specified number of approvals were met, labeling the PR as "Review required" otherwise.

Github branch protection setting rule

We've since turned this rule off in order to use policy-bot but this has had the unintended consequence of applying the "Approved" label prematurely. Is there a way to get policy-bot to work in harmony with this labeler?

Unfortunately, there is no way that I know of to make this "Approved" UI element agree with Policy Bot. I believe this is something GitHub puts in the UI when either the the native review requirements are met or if reviews are not required, when there's at least one approval from a user with write access. As a summary of the review state, I don't think there's any way to manipulate it via the API, other than by leaving reviews.

If you have access to GitHub Support, it might be worth asking them about how this is generated and if there is any way to change the behavior. But I suspect this is an inconsistency that you'll have to live with if using Policy Bot and rules that require multiple approvals.

Thank you for sharing your input, @bluekeyes. Hopefully, this serves as a form of documentation for others. I'll reach out to GitHub Support regarding the issue and see what they suggest. If there's any way to address this discrepancy, I'll update this issue with the suggestion. In the meantime, I guess we'll have to be extra diligent with applying our custom "Approved" label on PRs ourselves.