[IMP] runbot_merge: add support for draft check

1cea247e6c missed the update of the
`draft` flag, add support for it.

Fixes #753
This commit is contained in:
Xavier Morel 2023-06-08 10:03:26 +02:00
parent 048ae0c5ff
commit e14616b2fb
2 changed files with 14 additions and 2 deletions

View File

@ -143,10 +143,17 @@ All substitutions are tentatively applied sequentially to the input.
},
'sender': {'login': self.project_id.github_prefix},
})
edit2 = ''
if pr_id.draft != pr['draft']:
edit2 = controllers.handle_pr(self.env, {
'action': 'converted_to_draft' if pr['draft'] else 'ready_for_review',
'pull_request': pr,
'sender': {'login': self.project_id.github_prefix}
}) + '. '
feedback({
'repository': pr_id.repository.id,
'pull_request': number,
'message': f"{edit}. {sync}.",
'message': f"{edit}. {edit2}{sync}.",
})
return

View File

@ -2520,6 +2520,7 @@ Please check and re-approve.
'state': 'ready',
'message': "Something else",
'target': other.id,
'draft': True,
})
with repo:
pr.post_comment('hansen check')
@ -2528,7 +2529,11 @@ Please check and re-approve.
assert pr_id.head == c2
assert pr_id.message == 'title\n\nbody' # the commit's message was used for the PR
assert pr_id.target.name == 'master'
assert pr.comments[-1] == (users['user'], f"Updated target, squash, message. Updated to {c2}.")
assert not pr_id.draft
assert pr.comments[-1] == (
users['user'],
f"Updated target, squash, message. Updated {pr_id.display_name} to ready. Updated to {c2}."
)
def test_update_closed(self, env, repo):
with repo: