Skip to content

Commit

Permalink
Merge pull request #691 from Fryguy/fix_pr_titles
Browse files Browse the repository at this point in the history
Fix issue where tags with dashes are ignored
  • Loading branch information
bdunne authored Jun 12, 2024
2 parents 07d3ef4 + 30fa42e commit b78c355
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/branch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def fq_pr_number
end

def pr_title_tags
pr_title.to_s.match(/^(?:\s*\[\w+\])+/).to_s.gsub("[", " [").split.map { |s| s[1...-1] }
pr_title.to_s.match(/^(?:\s*\[[\w-]+\])+/).to_s.gsub("[", " [").split.map { |s| s[1...-1] }
end

def github_pr_uri
Expand Down
5 changes: 5 additions & 0 deletions spec/models/branch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
expect(branch.pr_title_tags).to eq ["WIP", "foo_bar"]
end

it "with a pr_title with tags with dashes" do
branch.pr_title = "[WIP] [2-EL9] This is a PR title"
expect(branch.pr_title_tags).to eq ["WIP", "2-EL9"]
end

it "with a pr_title with tag-like strings not at the start" do
branch.pr_title = "This is a [PR] title"
expect(branch.pr_title_tags).to eq []
Expand Down

0 comments on commit b78c355

Please sign in to comment.