diff --git a/src/submit/execute.rs b/src/submit/execute.rs index 5ed2787..063b5dd 100644 --- a/src/submit/execute.rs +++ b/src/submit/execute.rs @@ -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 => { @@ -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 === diff --git a/tests/unit_tests.rs b/tests/unit_tests.rs index baddca6..3692623 100644 --- a/tests/unit_tests.rs +++ b/tests/unit_tests.rs @@ -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)], @@ -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}" ); } }