Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/submit/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,15 @@ fn format_stack_comment_for_platform(
let is_current = i == reversed_idx;
match platform {
Platform::GitHub => {
// GitHub: "* PR title #N" - #N auto-links to PRs
// GitHub: "* #N" - GitHub auto-expands to show title with rich previews
if is_current {
let _ = writeln!(
body,
"* **{} #{} {STACK_COMMENT_THIS_PR}**",
item.pr_title, item.pr_number
"* **#{} {STACK_COMMENT_THIS_PR}**",
item.pr_number
);
} else {
let _ = writeln!(body, "* {} #{}", item.pr_title, item.pr_number);
let _ = writeln!(body, "* #{}", item.pr_number);
}
}
Platform::GitLab => {
Expand Down Expand Up @@ -801,6 +801,8 @@ mod tests {
!body.contains("](https://github.com/test/test/pull"),
"GitHub should NOT have markdown links to PRs: {body}"
);
// Title should NOT be in the output - GitHub will auto-expand it
assert!(!body.contains("feat: add auth"), "GitHub auto-expands, so title should not be in source: {body}");
}

// === Plan helper tests ===
Expand Down
10 changes: 7 additions & 3 deletions tests/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@ mod stack_comment_test {
}

#[test]
fn test_format_body_contains_pr_title() {
fn test_format_body_github_no_duplicate_title() {
// GitHub format should NOT contain PR title since GitHub auto-expands #N references
let data = StackCommentData {
version: 1,
stack: vec![make_stack_item("feat-a", 1)],
Expand All @@ -733,9 +734,12 @@ mod stack_comment_test {

let body = format_stack_comment(&data, 0).unwrap();

// Should contain the PR number reference
assert!(body.contains("#1"), "body should contain #1: {body}");
// Should NOT contain the PR title (GitHub will auto-expand it)
assert!(
body.contains("feat: feat-a"),
"body should contain PR title: {body}"
!body.contains("feat: feat-a"),
"body should NOT contain PR title (GitHub auto-expands): {body}"
);
}
}
Expand Down