Skip to content

Commit 3755bdd

Browse files
Copilotalexr00
andauthored
Fix PR title generation from branch name to match GitHub.com behavior (#8558)
* Initial plan * chore: initial plan for branch name to PR title fix Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * fix: replace dashes and underscores with spaces in PR title generated from branch name Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 66a2314 commit 3755bdd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/github/createPRViewProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,8 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
758758

759759
const name = compareBranch.name;
760760
const branchNameTitle = (name: string) => {
761-
return `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
761+
const nameWithSpaces = name.replace(/[-_]/g, ' ');
762+
return `${nameWithSpaces.charAt(0).toUpperCase()}${nameWithSpaces.slice(1)}`;
762763
};
763764

764765
// If branchName is selected, use the branch name as the title

0 commit comments

Comments
 (0)