From 2174d7da31089371b6b93dddc326333ff14c36dd Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 22 Oct 2024 13:12:28 +0200 Subject: [PATCH] [IMP] runbot_merge: optimise edited event For the longest time Github's `change` key was borked when transitioning a description to and from empty. They fixed that during 2023, which I already saw and impacted on DC (xmo-odoo/dummy_central@1ebed9d4183d34fa412f6556aedde019803a15a0 and xmo-odoo/dummy_central@937e87c2a4383f5ffcda6756443b082d2bde14bd) but this had yet to be taken in account by the mergebot. This is now done, the code is functionally reverted to what it was before I realised `changes` was hosed and moved off of it in 3da18741963e80b34fd98055ecb6bc1483d09c35. Fixes #743 --- runbot_merge/controllers/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/runbot_merge/controllers/__init__.py b/runbot_merge/controllers/__init__.py index 969331ea..eaaec321 100644 --- a/runbot_merge/controllers/__init__.py +++ b/runbot_merge/controllers/__init__.py @@ -210,12 +210,8 @@ def handle_pr(env, event): updates['target'] = branch.id updates['squash'] = pr['commits'] == 1 - # turns out github doesn't bother sending a change key if the body is - # changing from empty (None), therefore ignore that entirely, just - # generate the message and check if it changed - message = utils.make_message(pr) - if message != pr_obj.message: - updates['message'] = message + if 'title' in event['changes'] or 'body' in event['changes']: + updates['message'] = utils.make_message(pr) _logger.info("update: %s = %s (by %s)", pr_obj.display_name, updates, event['sender']['login']) if updates: