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
23 changes: 23 additions & 0 deletions cmd/goose/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"fmt"
"os"
"runtime"
"strings"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -110,6 +111,17 @@
// 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)
Expand All @@ -122,6 +134,17 @@

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)
Expand Down Expand Up @@ -324,7 +347,7 @@

// Call setTrayTitle to get the actual title
app.setTrayTitle()
actualTitle := app.systrayInterface.(*MockSystray).title

Check failure on line 350 in cmd/goose/main_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value is not checked (errcheck)

// Adjust expected title based on platform
expectedTitle := tt.expectedTitle
Expand Down
9 changes: 7 additions & 2 deletions cmd/goose/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading