mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot_merge: add logging to PR sync and reset error PRs to open
The choice to keep sync'd PRs in error means it's possible to update the code and re-run the PR directly without it going through review & CI again, which is a bit odd. Remove the special case and always reset a sync'd PR to opened for clarity and simplicity. closes #71 closes #83
This commit is contained in:
parent
c34e8ca083
commit
eea3211f2b
@ -157,11 +157,19 @@ def handle_pr(env, event):
|
||||
pr_obj.repository.name, pr_obj.number,
|
||||
event['sender']['login']
|
||||
)
|
||||
if pr_obj.state != 'error':
|
||||
pr_obj.state = 'opened'
|
||||
|
||||
pr_obj.head = pr['head']['sha']
|
||||
pr_obj.squash = pr['commits'] == 1
|
||||
_logger.info(
|
||||
"PR %s:%s updated to %s by %s, resetting to 'open' and squash=%s",
|
||||
pr_obj.repository.name, pr_obj.number,
|
||||
pr['head']['sha'], event['sender']['login'],
|
||||
pr['commits'] == 1
|
||||
)
|
||||
|
||||
pr_obj.write({
|
||||
'state': 'opened',
|
||||
'head': pr['head']['sha'],
|
||||
'squash': pr['commits'] == 1,
|
||||
})
|
||||
return 'Updated {} to {}'.format(pr_obj.id, pr_obj.head)
|
||||
|
||||
# don't marked merged PRs as closed (!!!)
|
||||
|
@ -1563,7 +1563,7 @@ class TestPRUpdate(object):
|
||||
c2 = repo.make_commit(c, 'first', None, tree={'m': 'cc'})
|
||||
prx.push(c2)
|
||||
assert pr.head == c2
|
||||
assert pr.state == 'error'
|
||||
assert pr.state == 'opened'
|
||||
|
||||
def test_unknown_pr(self, env, repo):
|
||||
m = repo.make_commit(None, 'initial', None, tree={'m': 'm'})
|
||||
|
Loading…
Reference in New Issue
Block a user