Add a link to b.p.o as a comment by kushaldas · Pull Request #24 · python/bedevere
I think I might know of a way to simplify this. If you made the format of the message be:
TAG_NAME = "issue-number CLOSING_TAG = f"<!-- /{TAG_NAME} -->" BPO_MSG = f"""{{body}} <!-- {TAG_NAME}: bpo-{{issue_number}} --> {{message}} {CLOSING_TAG} """
Then you can do:
if CLOSING_TAG not in body: ...
That way the search is a straight-forward string search and you leave the re module out of it. And by embedding the issue number in the comment you add a little bit of extra detail that may be useful later (e.g. if someone adds support to detect a change of issue number in the title and wants to update the comment accordingly but doesn't want to worry about any format change in the message itself).