From 95dd0c4ccd68b8e74a7f829f901a1f00475036e3 Mon Sep 17 00:00:00 2001 From: Colin Lienard <64312634+colinlienard@users.noreply.github.com> Date: Mon, 22 Jan 2024 21:26:24 +0100 Subject: [PATCH] feat: add issue id in pr name (#9) --- src/config.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 0c39ee1..a12e32a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -118,10 +118,20 @@ impl Config { .with_validator(not_empty_validator) .prompt()?; - let pr_name = Text::new("Pull request name:") + let mut pr_name = Text::new("Pull request name:") .with_validators(&[Box::new(not_empty_validator), Box::new(pr_name_validator)]) .prompt()?; + let splited_branch = linear_branch.split('-').collect::>(); + if splited_branch.len() > 1 { + pr_name = format!( + "{} [{}-{}]", + pr_name, + splited_branch[0].to_uppercase(), + splited_branch[1] + ) + } + let prefix = pr_name.split(' ').collect::>()[0]; let branch_prefix = match prefix { "Add" => "feature",