-
Notifications
You must be signed in to change notification settings - Fork 58
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: Pull Request Reviews #402
base: main
Are you sure you want to change the base?
Conversation
data.NewField("pull_request_number", nil, []int64{}), | ||
data.NewField("pull_request_title", nil, []string{}), | ||
data.NewField("pull_request_state", nil, []string{}), | ||
data.NewField("pull_request_url", nil, []string{}), | ||
data.NewField("pull_request_author_name", nil, []string{}), | ||
data.NewField("pull_request_author_login", nil, []string{}), | ||
data.NewField("pull_request_author_email", nil, []string{}), | ||
data.NewField("pull_request_author_company", nil, []string{}), | ||
data.NewField("repository", nil, []string{}), | ||
data.NewField("review_author_name", nil, []string{}), | ||
data.NewField("review_author_login", nil, []string{}), | ||
data.NewField("review_author_email", nil, []string{}), | ||
data.NewField("review_author_company", nil, []string{}), | ||
data.NewField("review_url", nil, []string{}), | ||
data.NewField("review_state", nil, []string{}), | ||
data.NewField("review_comment_count", nil, []int64{}), | ||
data.NewField("review_updated_at", nil, []time.Time{}), | ||
data.NewField("review_created_at", nil, []time.Time{}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I love the prefixes here, but to be the most straightforward to users this felt right?
variables["reviewCursor"] = pr.Reviews.PageInfo.EndCursor | ||
if err := client.Query(ctx, q, variables); err != nil { | ||
return nil, errors.WithStack(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Majority of cases this'll never happen, but covering the case of more than 100 reviews
URL string | ||
Author Author | ||
State githubv4.PullRequestReviewState | ||
CommentsCount int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just keeping track of the number of comments; otherwise, this gets even more nested with PRs containing Reviews containing Comments
|
||
const defaultTimeField = timeFieldOptions[0].value; | ||
|
||
const QueryEditorPullRequestReviews = (props: Props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy and paste of the Pull Request one as they're going to be identical form wise
Unused variable results in errors
Panda's Pull Reminders Example Leaderboard PanelPanel JSON{
"type": "table",
"title": "Leaderboard",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
},
"datasource": {
"uid": "ae6qd8evnl1xcd",
"type": "grafana-github-datasource"
},
"id": 1,
"targets": [
{
"datasource": {
"type": "grafana-github-datasource",
"uid": "ae6qd8evnl1xcd"
},
"refId": "A",
"queryType": "Pull_Request_Reviews",
"repository": "github-datasource",
"owner": "grafana",
"options": {
"query": "is:merged",
"timeField": 2
}
}
],
"options": {
"showHeader": true,
"cellHeight": "sm",
"footer": {
"show": false,
"reducer": [
"sum"
],
"countRows": false,
"fields": ""
}
},
"transformations": [
{
"id": "groupBy",
"options": {
"fields": {
"pull_request_number": {
"aggregations": [
"distinctCount"
],
"operation": "aggregate"
},
"review_author_login": {
"aggregations": [],
"operation": "groupby"
},
"review_comment_count": {
"aggregations": [
"sum"
],
"operation": "aggregate"
}
}
}
},
{
"id": "calculateField",
"options": {
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"binary": {
"left": "review_comment_count (sum)",
"operator": "/",
"right": "pull_request_number (distinctCount)"
},
"alias": ""
}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {},
"renameByName": {
"review_author_login": "Author",
"review_comment_count (sum)": "Comments",
"pull_request_number (distinctCount)": "Pull Requests Reviewed",
"Ratio": "",
"review_comment_count (sum) / pull_request_number (distinctCount)": "Ratio"
},
"includeByName": {}
}
}
],
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": null,
"color": "green"
},
{
"value": 80,
"color": "red"
}
]
},
"color": {
"mode": "thresholds"
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Author"
},
"properties": [
{
"id": "links",
"value": [
{
"title": "",
"url": "https://github.com/${__data.fields.Author}",
"targetBlank": true
}
]
}
]
}
]
},
"pluginVersion": "10.4.2",
"description": "Example panel akin to Panda's Pull Reminders Analytics"
} |
Closes #70 EDIT: realizing that #70 is already covered by current features
This introduces a new query type of Pull Request Reviews. This is separate from Pull Requests due to
adding more paginated queries to handle more than 100 reviews (I imagine this is quite rare) as well as pulling more data.
Combining pull requests and reviews results in a lot of duplication that doesn't make sense for other PR use cases. I believe I've implemented all the necessary components here for this integration, but please let me know if I'm missing anything
Use Case