Skip to content

Commit

Permalink
feat: add issue id in pr name (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlienard authored Jan 22, 2024
1 parent 8fb33a0 commit 95dd0c4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<&str>>();
if splited_branch.len() > 1 {
pr_name = format!(
"{} [{}-{}]",
pr_name,
splited_branch[0].to_uppercase(),
splited_branch[1]
)
}

let prefix = pr_name.split(' ').collect::<Vec<&str>>()[0];
let branch_prefix = match prefix {
"Add" => "feature",
Expand Down

0 comments on commit 95dd0c4

Please sign in to comment.