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: bigger merge status #536

Merged
merged 7 commits into from
Feb 22, 2025
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
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ docs-prepare:
.PHONY: docs
docs:
cd docs && hugo server

.PHONY: mock
mock:
killgrave --config ./imposters/config.yml &
FF_MOCK_DATA=true go run . --debug

.PHONY: mock-stop
mock-stop:
killall killgrave
40 changes: 24 additions & 16 deletions data/prapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,29 @@ type PullRequestData struct {
Author struct {
Login string
}
AuthorAssociation string
UpdatedAt time.Time
CreatedAt time.Time
Url string
State string
Mergeable string
ReviewDecision string
Additions int
Deletions int
HeadRefName string
BaseRefName string
HeadRepository struct {
AuthorAssociation string
UpdatedAt time.Time
CreatedAt time.Time
Url string
State string
Mergeable string
ReviewDecision string
Additions int
Deletions int
HeadRefName string
BaseRefName string
HeadRepository struct {
Name string
}
HeadRef struct {
Name string
}
Repository Repository
Assignees Assignees `graphql:"assignees(first: 3)"`
Comments Comments `graphql:"comments(last: 5, orderBy: { field: UPDATED_AT, direction: DESC })"`
LatestReviews Reviews `graphql:"latestReviews(last: 3)"`
ReviewThreads ReviewThreads `graphql:"reviewThreads(last: 20)"`
Assignees Assignees `graphql:"assignees(first: 3)"`
Comments Comments `graphql:"comments(last: 5, orderBy: { field: UPDATED_AT, direction: DESC })"`
Reviews Reviews `graphql:"reviews(last: 3)"`
ReviewThreads ReviewThreads `graphql:"reviewThreads(last: 20)"`
ReviewRequests ReviewRequests `graphql:"reviewRequests(last: 10)"`
IsDraft bool
Commits Commits `graphql:"commits(last: 1)"`
Labels PRLabels `graphql:"labels(first: 3)"`
Expand Down Expand Up @@ -152,6 +153,13 @@ type ReviewThreads struct {
}
}

type ReviewRequests struct {
TotalCount int
Nodes []struct {
AsCodeOwner bool `graphql:"asCodeOwner"`
}
}

type PRLabel struct {
Color string
Name string
Expand Down
20 changes: 17 additions & 3 deletions data/repository.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
package data

import (
graphql "github.com/cli/shurcooL-graphql"
)

type BranchProtectionRules struct {
Nodes []struct {
RequiredApprovingReviewCount int
RequiresApprovingReviews graphql.Boolean
RequiresCodeOwnerReviews graphql.Boolean
RequiresStatusChecks graphql.Boolean
}
}

type Repository struct {
Name string
NameWithOwner string
IsArchived bool
Name string
NameWithOwner string
IsArchived bool
BranchProtectionRules BranchProtectionRules `graphql:"branchProtectionRules(first: 1)"`
}
11 changes: 10 additions & 1 deletion data/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"time"

"github.com/charmbracelet/lipgloss"

"github.com/dlvhdr/gh-dash/v4/ui/theme"
)

Expand All @@ -22,11 +23,19 @@ func IsStatusWaiting(status string) bool {
status == "WAITING"
}

func IsConclusionASkip(conclusion string) bool {
return conclusion == "SKIPPED"
}

func IsConclusionAFailure(conclusion string) bool {
return conclusion == "FAILURE" || conclusion == "TIMED_OUT" || conclusion == "STARTUP_FAILURE"
}

func GetAuthorRoleIcon(role string, theme theme.Theme) string {
func IsConclusionASuccess(conclusion string) bool {
return conclusion == "SUCCESS"
}

func GetAuthorRoleIcon(role string, theme theme.Theme) string {
// https://docs.github.com/en/graphql/reference/enums#commentauthorassociation
switch role {
case "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "NONE":
Expand Down
Loading