diff --git a/src/cli/commands/ship.rs b/src/cli/commands/ship.rs index 4009d46..34db416 100644 --- a/src/cli/commands/ship.rs +++ b/src/cli/commands/ship.rs @@ -172,6 +172,7 @@ pub async fn ship( let pr_body = build_pr_body( &result.ticket, + &result.branch, effective_title, ticket_url.as_deref(), stack_info.as_ref(), @@ -421,8 +422,33 @@ fn gather_stack_info(manager: &WorktreeManager, ticket: &str) -> Option, + ticket_url: Option<&str>, +) -> String { + template + .replace("{{ticket}}", ticket) + .replace("{{branch}}", branch) + .replace("{{title}}", title.unwrap_or("")) + .replace("{{ticket_url}}", ticket_url.unwrap_or("")) +} + fn build_pr_body( ticket: &str, + branch: &str, title: Option<&str>, ticket_url: Option<&str>, stack_info: Option<&StackPrInfo>, @@ -461,10 +487,11 @@ fn build_pr_body( body.push('\n'); } - // Include PR template content (#233) + // Include PR template content (#233 #304) with variable substitution. if let Some(tmpl) = template_content { + let rendered = substitute_template_vars(tmpl, ticket, branch, title, ticket_url); body.push_str("---\n\n"); - body.push_str(tmpl); + body.push_str(&rendered); body.push('\n'); } @@ -504,3 +531,60 @@ fn resolve_template(repo_root: &Path, explicit_path: Option<&str>) -> Option