Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pr-status): add build status to pr-status list table #129

Merged
4 changes: 2 additions & 2 deletions cmd/prstatus/prstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func run(c *cobra.Command, _ []string) {
statuses := make(map[string]int)
reactions := make(map[string]int)

detailsTable := table.New("Repository", "State", "Reviews", "URL")
detailsTable := table.New("Repository", "State", "Reviews", "Build status", "URL")
rnorth marked this conversation as resolved.
Show resolved Hide resolved
detailsTable.WithHeaderFormatter(color.New(color.Underline).SprintfFunc())
detailsTable.WithFirstColumnFormatter(color.New(color.FgCyan).SprintfFunc())
detailsTable.WithWriter(logger.Writer())
Expand Down Expand Up @@ -118,7 +118,7 @@ func run(c *cobra.Command, _ []string) {
reactions[reaction.Content] += reaction.Users.TotalCount
}

detailsTable.AddRow(repo.FullRepoName, prStatus.State, prStatus.ReviewDecision, prStatus.Url)
detailsTable.AddRow(repo.FullRepoName, prStatus.State, prStatus.ReviewDecision, prStatus.Mergeable, prStatus.Url)

checkStatusActivity.EndWithSuccess()
}
Expand Down
9 changes: 6 additions & 3 deletions cmd/prstatus/prstatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func TestItLogsDetailedInformation(t *testing.T) {
assert.Regexp(t, "Open\\s+1", out)
assert.Regexp(t, "👍\\s+4", out)

assert.Regexp(t, "org/repo1\\s+OPEN\\s+REVIEW_REQUIRED", out)
assert.Regexp(t, "org/repo2\\s+MERGED\\s+APPROVED", out)
assert.Regexp(t, "org/repo3\\s+CLOSED", out)
assert.Regexp(t, "org/repo1\\s+OPEN\\s+REVIEW_REQUIRED\\s+MERGEABLE", out)
assert.Regexp(t, "org/repo2\\s+MERGED\\s+APPROVED\\s+UNKNOWN", out)
assert.Regexp(t, "org/repo3\\s+CLOSED\\s+UNKNOWN", out)
}

func TestItSkipsUnclonedRepos(t *testing.T) {
Expand Down Expand Up @@ -119,6 +119,7 @@ func prepareFakeResponses() {
dummyData := map[string]*github.PrStatus{
"work/org/repo1": {
State: "OPEN",
Mergeable: "MERGEABLE",
ReactionGroups: []github.ReactionGroup{
{
Content: "THUMBS_UP",
Expand All @@ -137,6 +138,7 @@ func prepareFakeResponses() {
},
"work/org/repo2": {
State: "MERGED",
Mergeable: "UNKNOWN",
ReactionGroups: []github.ReactionGroup{
{
Content: "THUMBS_UP",
Expand All @@ -149,6 +151,7 @@ func prepareFakeResponses() {
},
"work/org/repo3": {
State: "CLOSED",
Mergeable: "UNKNOWN",
ReactionGroups: []github.ReactionGroup{
{
Content: "THUMBS_DOWN",
Expand Down
Loading