From 44ad4a5be6c19f3722566bd1082b880c003e6910 Mon Sep 17 00:00:00 2001 From: Simone Rubino Date: Mon, 10 Oct 2022 12:15:49 +0200 Subject: [PATCH] [FIX] migration_issue_bot: Duplicated line for PRs A new line was created because the regex was expecting something after the module name --- src/oca_github_bot/tasks/migration_issue_bot.py | 2 +- tests/test_migration_issue_bot.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/oca_github_bot/tasks/migration_issue_bot.py b/src/oca_github_bot/tasks/migration_issue_bot.py index 510c435e..b4911a7c 100644 --- a/src/oca_github_bot/tasks/migration_issue_bot.py +++ b/src/oca_github_bot/tasks/migration_issue_bot.py @@ -39,7 +39,7 @@ def _set_lines_issue(gh_pr_user_login, gh_pr_number, issue_body, module): if added: # Bypass the checks for faster completion lines.append(line) continue - groups = re.match(rf"^- \[( |x)\] {module}( |\r)", line) + groups = re.match(rf"^- \[( |x)\] \b{module}\b", line) if groups: # Line found # Get the Old PR value regex = r"\#(\d*)" diff --git a/tests/test_migration_issue_bot.py b/tests/test_migration_issue_bot.py index 1cd703d2..5ace8f7c 100644 --- a/tests/test_migration_issue_bot.py +++ b/tests/test_migration_issue_bot.py @@ -53,6 +53,14 @@ def test_set_lines_issue(gh): f"- [x] {module} - By @{gh_pr_user_login} - #{gh_pr_number}\n" f"- [ ] z_module_1 - By @pedrobaeza - #2", ), + ( + f"Issue with list containing the module with no PR\n" + f"- [x] {module}\n" + f"- [ ] z_module_1 - By @pedrobaeza - #2", + f"Issue with list containing the module with no PR\n" + f"- [x] {module} - By @{gh_pr_user_login} - #{gh_pr_number}\n" + f"- [ ] z_module_1 - By @pedrobaeza - #2", + ), ( "Issue with no list", f"Issue with no list\n"