Repository navigation
Do not approve draft pull requests - #368
jaydev-CAstra wants to merge 2 commits into
Conversation
set_config restored the new value instead of the saved one, and test_switchable_method left BOT_TASKS set to its last value, so every switchable task called by a later test was silently disabled.
A draft PR is not ready for review, so tag_approved no longer sets the approved label on it and removes the approved and ready to merge labels if it has them. Converting a PR to draft and marking it ready for review now re-evaluate the labels, and the ready to merge search skips drafts. Fixes OCA#305
|
@legalsylvain It would be nice if you comment the reason why you close the PRs when closing them. |
I don't see the point in talking to a robot. And I don't want to waste my time doing that. Thanks. |
I want to believe it's a real person that uses some LLM, not a real robot, so I think being a bit nicer to a contributor cannot be that difficult. @sbidoul, the PR fixes an issue you created, so you may want to say something here. |
I'll not make effort to be "nice" with such robotized contribution. Feel free to reopen. |
Fixes #305
Problem
tag_approvedonly looks at the reviews: a draft PR with enough approvals gets theapprovedlabel, and when an approved PR is converted back to draft nothing removes theapprovedandready to mergelabels (no webhook handles that event, and the task would keep them anyway).Reproduced with unit tests on a mocked PR (
draft=True, two approvals): the task addsapprovedand schedulestag_ready_to_merge.Fix
tag_approved: a draft PR is never approved; if it carries theapproved/ready to mergelabels they are removed, same as when changes are requested.on_pr_draftonpull_requestactionsconverted_to_draftandready_for_review, which re-evaluatestag_approvedfor the PR.tag_ready_to_merge: the search query getsdraft:false, so a draft PR that still has theapprovedlabel cannot becomeready to merge.305.bugfixnewsfragment.Tests
tests/test_tag_approved.py(new): approved label added, labels removed on changes requested, draft PR not approved, draft PR loses its labels.tests/test_on_pr_draft.py(new): the webhook schedulestag_approved.set_config()restored the new value instead of the saved one, andtest_switchable_methodleftBOT_TASKSmodified, so any switchable task called by a later test was silently disabled (that is how the new tests first failed in the full run while passing alone). Both are now restored properly.78 tests pass locally (the 3
test_build_wheelstests are skipped here because this machine's Python has noensurepip, unrelated).