Pull request branch name should contain both the issue number and the title of the issue. #14

Merged
Jmaa merged 2 commits from jmaa/issue-pull-request-branch-name-should-contain-both-the-issue-number-and-the-title-of-the-issue into main 2025-04-13 14:47:39 +00:00
Showing only changes of commit 298402ff2b - Show all commits

View File

@ -24,8 +24,8 @@ def generate_branch_name(issue_number: str, issue_title: str) -> str:
Non-alphanumeric characters (except spaces) are removed,
the text is lowercased, and spaces are replaced with dashes.
"""
title_slug = issue_title.lower().replace(" ", "-")
return f"issue-{issue_number}-{title_slug}"
sanitized = re.sub(r"[^0-9a-zA-Z ]+", "", issue_title)
return "issue-" + "-".join(sanitized.lower().split())
logger = logging.getLogger(__name__)