Add dashboard / description page

This commit is contained in:
2026-07-28 09:58:49 +02:00
parent 60d64dedb2
commit 43fa047765
9 changed files with 465 additions and 51 deletions

View File

@@ -182,10 +182,15 @@ const detailsQuery = `
query PullRequestDetails($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
id number title url body isDraft updatedAt mergeable reviewDecision
id number title url body isDraft createdAt updatedAt
mergeable mergeStateStatus reviewDecision
baseRefName headRefName
author { login }
assignees(first: 20) { nodes { login } }
labels(first: 20) { nodes { name } }
milestone { title }
additions deletions changedFiles
comments(first: 1) { totalCount }
reviewRequests(first: 50) {
nodes {
requestedReviewer {
@@ -196,6 +201,7 @@ query PullRequestDetails($owner: String!, $name: String!, $number: Int!) {
}
latestReviews(first: 50) { nodes { state author { login } } }
commits(last: 1) {
totalCount
nodes { commit { statusCheckRollup { state } } }
}
reviewThreads(first: 100) {
@@ -227,14 +233,26 @@ func (c *GitHubClient) GetPullRequest(ctx context.Context, owner, name string, n
var data struct {
Repository *struct {
PullRequest *struct {
ID, Title, URL, Body, Mergeable, ReviewDecision, BaseRefName, HeadRefName string
Number int
IsDraft bool
UpdatedAt time.Time
Author *actor
Assignees struct {
ID, Title, URL, Body, Mergeable, MergeStateStatus string
ReviewDecision, BaseRefName, HeadRefName string
Number, Additions, Deletions, ChangedFiles int
IsDraft bool
CreatedAt, UpdatedAt time.Time
Author *actor
Assignees struct {
Nodes []actor `json:"nodes"`
}
Labels struct {
Nodes []struct {
Name string `json:"name"`
} `json:"nodes"`
}
Milestone *struct {
Title string `json:"title"`
}
Comments struct {
TotalCount int `json:"totalCount"`
}
ReviewRequests struct {
Nodes []struct {
RequestedReviewer actor `json:"requestedReviewer"`
@@ -247,7 +265,8 @@ func (c *GitHubClient) GetPullRequest(ctx context.Context, owner, name string, n
} `json:"nodes"`
}
Commits struct {
Nodes []struct {
TotalCount int `json:"totalCount"`
Nodes []struct {
Commit struct {
StatusCheckRollup *struct{ State string }
}
@@ -295,9 +314,18 @@ func (c *GitHubClient) GetPullRequest(ctx context.Context, owner, name string, n
Author: author, IsDraft: node.IsDraft, UpdatedAt: node.UpdatedAt,
ReviewCount: len(node.ReviewThreads.Nodes),
},
Body: node.Body, BaseRef: node.BaseRefName, HeadRef: node.HeadRefName,
Mergeable: node.Mergeable, ThreadsTruncated: node.ReviewThreads.PageInfo.HasNextPage,
CheckState: "NONE", ReviewDecision: node.ReviewDecision,
Body: node.Body, CreatedAt: node.CreatedAt, BaseRef: node.BaseRefName, HeadRef: node.HeadRefName,
Mergeable: node.Mergeable, MergeState: node.MergeStateStatus,
Additions: node.Additions, Deletions: node.Deletions, ChangedFiles: node.ChangedFiles,
CommitCount: node.Commits.TotalCount, CommentCount: node.Comments.TotalCount,
ThreadsTruncated: node.ReviewThreads.PageInfo.HasNextPage,
CheckState: "NONE", ReviewDecision: node.ReviewDecision,
}
for _, label := range node.Labels.Nodes {
details.Labels = append(details.Labels, label.Name)
}
if node.Milestone != nil {
details.Milestone = node.Milestone.Title
}
for _, assignee := range node.Assignees.Nodes {
details.Assignees = append(details.Assignees, assignee.Login)