Skip to content
Merged
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
43 changes: 17 additions & 26 deletions cli/release-automation/internal/automation/release_pr_body.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,48 +69,39 @@ func clarifyReleasePRCheckComponentHeadingBlock(block string) (string, bool) {

component := matches[1]
version := matches[2]
changed := false
displaySlug, found := releasePRCheckComponentDisplaySlug(component)
if !found {
return block, false
}

if summarySlug, found := releasePRCheckComponentSummarySlug(component); found {
clarifiedSummary := "<details><summary>" + summarySlug + ": " + version + "</summary>"
changed := false
if displaySlug != component {
clarifiedSummary := "<details><summary>" + displaySlug + ": " + version + "</summary>"
block = strings.Replace(block, matches[0], clarifiedSummary, 1)
changed = true
}

displayName, found := releasePRCheckComponentDisplayName(component)
if !found {
return block, changed
}

heading := "## [" + version + "]("
if !strings.Contains(block, heading) {
return block, changed
}

clarifiedHeading := "## [" + displayName + " " + version + "]("
clarifiedHeading := "## [" + displaySlug + ": " + version + "]("
return strings.Replace(block, heading, clarifiedHeading, 1), true
}

// releasePRCheckComponentSummarySlug renames component summary labels whose
// release-please component id lacks the uloop prefix. The release tag keeps
// the bare component id, so consumers that resolve tags from summaries must
// also accept the renamed slug (see release_tag_from_body in
// releasePRCheckComponentDisplaySlug labels both the collapsible summary and
// the changelog heading of a component block with the same slug. The
// dispatcher slug gains the uloop prefix for display, while its release tag
// keeps the bare component id, so consumers that resolve tags from summaries
// must also accept the renamed slug (see release_tag_from_body in
// scripts/sync-published-release-pr-labels.sh).
func releasePRCheckComponentSummarySlug(component string) (string, bool) {
if component == "dispatcher" {
return "uloop-dispatcher", true
}
return "", false
}

func releasePRCheckComponentDisplayName(component string) (string, bool) {
func releasePRCheckComponentDisplaySlug(component string) (string, bool) {
switch component {
case "unity-package":
return "Unity Package", true
case "unity-package", "uloop-project-runner":
return component, true
case "dispatcher", "uloop-dispatcher":
return "uloop Dispatcher", true
case "uloop-project-runner":
return "uloop Project Runner", true
return "uloop-dispatcher", true
default:
return "", false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ func TestReleasePRCheckComponentHeadingsAreClarified(t *testing.T) {
if !changed {
t.Fatal("expected component release headings to change")
}
assertReleasePRCheckLogContains(t, clarifiedBody, "## [Unity Package 3.0.0-beta.48](https://example.test/compare/v3.0.0-beta.47...v3.0.0-beta.48) (2026-07-01)")
assertReleasePRCheckLogContains(t, clarifiedBody, "## [uloop Dispatcher 3.0.1-beta.13](https://example.test/compare/dispatcher-v3.0.1-beta.12...dispatcher-v3.0.1-beta.13) (2026-07-11)")
assertReleasePRCheckLogContains(t, clarifiedBody, "## [uloop Project Runner 3.0.0-beta.45](https://example.test/compare/uloop-project-runner-v3.0.0-beta.44...uloop-project-runner-v3.0.0-beta.45) (2026-07-01)")
assertReleasePRCheckLogContains(t, clarifiedBody, "## [unity-package: 3.0.0-beta.48](https://example.test/compare/v3.0.0-beta.47...v3.0.0-beta.48) (2026-07-01)")
assertReleasePRCheckLogContains(t, clarifiedBody, "## [uloop-dispatcher: 3.0.1-beta.13](https://example.test/compare/dispatcher-v3.0.1-beta.12...dispatcher-v3.0.1-beta.13) (2026-07-11)")
assertReleasePRCheckLogContains(t, clarifiedBody, "## [uloop-project-runner: 3.0.0-beta.45](https://example.test/compare/uloop-project-runner-v3.0.0-beta.44...uloop-project-runner-v3.0.0-beta.45) (2026-07-01)")
assertReleasePRCheckLogContains(t, clarifiedBody, "<details><summary>uloop-dispatcher: 3.0.1-beta.13</summary>")
assertReleasePRCheckLogContains(t, clarifiedBody, "<details><summary>unity-package: 3.0.0-beta.48</summary>")
assertReleasePRCheckLogContains(t, clarifiedBody, "<details><summary>uloop-project-runner: 3.0.0-beta.45</summary>")
Expand All @@ -87,7 +87,7 @@ func TestReleasePRCheckComponentHeadingsAreClarified(t *testing.T) {
// Verifies an already clarified dispatcher block stays unchanged on a second clarification pass.
func TestReleasePRCheckClarifiedDispatcherBlockIsStable(t *testing.T) {
body := "<details><summary>uloop-dispatcher: 3.0.1-beta.13</summary>\n\n" +
"## [uloop Dispatcher 3.0.1-beta.13](https://example.test/compare/dispatcher-v3.0.1-beta.12...dispatcher-v3.0.1-beta.13) (2026-07-11)\n" +
"## [uloop-dispatcher: 3.0.1-beta.13](https://example.test/compare/dispatcher-v3.0.1-beta.12...dispatcher-v3.0.1-beta.13) (2026-07-11)\n" +
"</details>\n"

clarifiedBody, changed := clarifyReleasePRCheckComponentLabels(body)
Expand Down
Loading