From f752af8130ce3cb8feaa39e2ee40c3cb2e1ad6d5 Mon Sep 17 00:00:00 2001 From: Robert Alonso <17463757+rgalonso@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:46:07 +0000 Subject: [PATCH] fix: perform case-insensitive search for identifier When searching for the comment line after which the issue URL will be inserted, use a case-insensitive search for the identifier portion of the line. This matches how TodoParser identifies TODOs using a case-insensitive search. Closes github.com/alstr/todo-to-issue-action#224 --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index b9f71b9..4672beb 100644 --- a/main.py +++ b/main.py @@ -76,7 +76,7 @@ def process_diff(diff, client=Client(), insert_issue_urls=False, parser=TodoPars if line_number < len(file_lines): # Duplicate the line to retain the comment syntax. old_line = file_lines[line_number] - remove = fr'{raw_issue.identifier}.*{raw_issue.title}' + remove = fr'(?i:{raw_issue.identifier}).*{raw_issue.title}' insert = f'Issue URL: {client.get_issue_url(new_issue_number)}' new_line = re.sub(remove, insert, old_line) # make sure the above operation worked as intended