Skip to content

Commit

Permalink
Allow a ticket_id prefix to save manual labour
Browse files Browse the repository at this point in the history
  • Loading branch information
martyzz1 committed Sep 2, 2024
1 parent 4261f88 commit 959bd54
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gitfeatures/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

master_branch = os.environ.get("GITFEATURES_MASTER_BRANCH", "master")
branch_seperator = os.environ.get("GITFEATURES_BRANCH_SEPERATOR", "_")
ticket_seperator = os.environ.get("GITFEATURES_TICKET_SEPERATOR", "_")
ticket_seperator = os.environ.get("GITFEATURES_TICKET_SEPERATOR", None)
ticket_prefix = os.environ.get("GITFEATURES_TICKET_PREFIX", "")
repo = os.environ.get("GITFEATURES_REPO", "github")
merge_strategy = os.environ.get("GITFEATURES_STRATEGY", "merge")
fork_pr_strategy = os.environ.get("GITFEATURES_FORK_PR_STRATEGY", "")
Expand All @@ -26,6 +27,9 @@ def _call(args):
def _get_branch_name(prefix, name, ticket_id):
branch_name = f"{prefix}{branch_seperator}{name}"
if ticket_id:
if ticket_prefix:
if not ticket_id.startswith(ticket_prefix):
ticket_id = f"{ticket_prefix}{ticket_id}"
branch_name = f"{prefix}{branch_seperator}{ticket_id}{ticket_seperator}{name}"
return branch_name

Expand Down

0 comments on commit 959bd54

Please sign in to comment.