diff --git a/cmd/goose/main_test.go b/cmd/goose/main_test.go index 8e0df14..75a1cd1 100644 --- a/cmd/goose/main_test.go +++ b/cmd/goose/main_test.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "runtime" + "strings" "sync" "testing" "time" @@ -110,6 +111,17 @@ func TestMenuItemTitleTransition(t *testing.T) { // This simulates what addPRSection does when building menu items for _, pr := range app.incoming { title := fmt.Sprintf("%s #%d", pr.Repository, pr.Number) + + // Add action code if present, or test state as fallback + if pr.ActionKind != "" { + // Replace underscores with spaces for better readability + actionDisplay := strings.ReplaceAll(pr.ActionKind, "_", " ") + title = fmt.Sprintf("%s — %s", title, actionDisplay) + } else if pr.TestState == "running" { + // Show "tests running" as a fallback when no specific action is available + title = fmt.Sprintf("%s — tests running...", title) + } + if pr.NeedsReview { if !pr.FirstBlockedAt.IsZero() && time.Since(pr.FirstBlockedAt) < testBlockDuration { title = fmt.Sprintf("🪿 %s", title) @@ -122,6 +134,17 @@ func TestMenuItemTitleTransition(t *testing.T) { for _, pr := range app.outgoing { title := fmt.Sprintf("%s #%d", pr.Repository, pr.Number) + + // Add action code if present, or test state as fallback + if pr.ActionKind != "" { + // Replace underscores with spaces for better readability + actionDisplay := strings.ReplaceAll(pr.ActionKind, "_", " ") + title = fmt.Sprintf("%s — %s", title, actionDisplay) + } else if pr.TestState == "running" { + // Show "tests running" as a fallback when no specific action is available + title = fmt.Sprintf("%s — tests running...", title) + } + if pr.IsBlocked { if !pr.FirstBlockedAt.IsZero() && time.Since(pr.FirstBlockedAt) < testBlockDuration { title = fmt.Sprintf("🎉 %s", title) diff --git a/cmd/goose/ui.go b/cmd/goose/ui.go index 909a015..c59f470 100644 --- a/cmd/goose/ui.go +++ b/cmd/goose/ui.go @@ -308,9 +308,14 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string, title := fmt.Sprintf("%s #%d", sortedPRs[prIndex].Repository, sortedPRs[prIndex].Number) - // Add action code if present + // Add action code if present, or test state as fallback if sortedPRs[prIndex].ActionKind != "" { - title = fmt.Sprintf("%s — %s", title, sortedPRs[prIndex].ActionKind) + // Replace underscores with spaces for better readability + actionDisplay := strings.ReplaceAll(sortedPRs[prIndex].ActionKind, "_", " ") + title = fmt.Sprintf("%s — %s", title, actionDisplay) + } else if sortedPRs[prIndex].TestState == "running" { + // Show "tests running" as a fallback when no specific action is available + title = fmt.Sprintf("%s — tests running...", title) } // Add bullet point or emoji based on PR status