Skip to content

Commit bf0e555

Browse files
Copilotalexr00
andcommitted
Address code review feedback: use consistent regex pattern and add documentation
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent bce8fa9 commit bf0e555

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/github/pullRequestGitHelper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,16 @@ export class PullRequestGitHelper {
368368
}
369369
}
370370

371+
/**
372+
* Performs variable substitution for PR checkout branch names.
373+
* Note: This is separate from the variableSubstitution in utils.ts because
374+
* the semantics differ - ${owner} refers to the PR author, not the repo owner.
375+
*/
371376
private static prBranchNameVariableSubstitution(
372377
template: string,
373378
pullRequest: PullRequestModel,
374379
): string {
375-
const VARIABLE_PATTERN = /\$\{([^}]*?)\}/g;
380+
const VARIABLE_PATTERN = /\$\{([^-]*?)(-.*?)?\}/g;
376381
return template.replace(VARIABLE_PATTERN, (match: string, variable: string) => {
377382
switch (variable) {
378383
case 'owner':

0 commit comments

Comments
 (0)