Skip to content
Open
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
18 changes: 14 additions & 4 deletions src/stack_pr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,10 @@ def create_pr(e: StackEntry, *, is_draft: bool, reviewer: str = "") -> None:


def generate_toc(st: list[StackEntry], current: str) -> str:
# Don't generate TOC for single PR
if len(st) == 1:
return ""

def toc_entry(se: StackEntry) -> str:
pr_id = last(se.pr)
arrow = "__->__" if pr_id == current else ""
Expand Down Expand Up @@ -791,10 +795,16 @@ def add_cross_links(st: list[StackEntry], *, keep_body: bool, verbose: bool) ->

# Strip stack-info from the body, nothing interesting there.
body = RE_STACK_INFO_LINE.sub("", body)
pr_body = [
f"{pr_toc}",
f"{CROSS_LINKS_DELIMETER}\n",
]
pr_body = []

# Only add TOC and delimiter if there are multiple PRs in the stack
if pr_toc:
pr_body.extend(
[
f"{pr_toc}",
f"{CROSS_LINKS_DELIMETER}\n",
]
)

if keep_body:
# Keep current body of the PR after the cross links component
Expand Down
Loading