Skip to content

fix(template): render stack section from caller-supplied order - #510

Open
davinkevin wants to merge 1 commit into
ejoffe:masterfrom
davinkevin:contrib/fix-stack-section-order
Open

fix(template): render stack section from caller-supplied order#510
davinkevin wants to merge 1 commit into
ejoffe:masterfrom
davinkevin:contrib/fix-stack-section-order

Conversation

@davinkevin

Copy link
Copy Markdown
Contributor

The PR body's stack list was generated from info.PullRequests, which holds whatever insertion order spr.UpdatePullRequests produced — after a reorder + new commits are appended, the pre-existing top PR ends up at index 0 and is rendered at the bottom of every body's stack section.

PRTemplatizer.Body now takes an explicit stack []*github.PullRequest. UpdatePullRequest forwards its already-sorted pullRequests parameter; CreatePullRequest forwards info.PullRequests as before.

Regression test in template_stack feeds a misordered info and a correctly-ordered stack, and asserts the rendered markdown follows the stack arg.

The PR body's stack list was generated from info.PullRequests, which
holds whatever insertion order spr.UpdatePullRequests produced — after
a reorder + new commits are appended, the pre-existing top PR ends up
at index 0 and is rendered at the bottom of every body's stack section.

PRTemplatizer.Body now takes an explicit stack []*github.PullRequest.
UpdatePullRequest forwards its already-sorted pullRequests parameter;
CreatePullRequest forwards info.PullRequests as before.

Regression test in template_stack feeds a misordered info and a
correctly-ordered stack, and asserts the rendered markdown follows
the stack arg.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant