[GraphQL] Get count of pull request approvals since approval decision? #52531
Replies: 2 comments 1 reply
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Have you tried the Demo PR: #9025 · cli/cli · GitHub query ($owner: String = "cli", $repo: String = "cli", $number: Int = 9025) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
timelineItems(first: 100, itemTypes: [PULL_REQUEST_REVIEW, PULL_REQUEST_COMMIT]) {
nodes {
... on PullRequestCommit {
commit {
committedDate
}
}
... on PullRequestReview {
author {
login
}
state
createdAt
}
}
}
}
}
} {
"data": {
"repository": {
"pullRequest": {
"timelineItems": {
"nodes": [
{
"commit": {
"committedDate": "2024-04-29T20:24:54Z"
}
},
{
"commit": {
"committedDate": "2024-04-29T20:31:28Z"
}
},
{
"author": {
"login": "andyfeller"
},
"state": "CHANGES_REQUESTED",
"createdAt": "2024-04-29T20:35:51Z"
},
{
"commit": {
"committedDate": "2024-04-29T20:38:35Z"
}
},
{
"commit": {
"committedDate": "2024-04-29T20:40:30Z"
}
},
{
"author": {
"login": "steiza"
},
"state": "APPROVED",
"createdAt": "2024-04-30T12:06:09Z"
},
{
"author": {
"login": "andyfeller"
},
"state": "APPROVED",
"createdAt": "2024-04-30T12:57:15Z"
}
]
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
I would like to count the number of pull request approvals since
PullRequest.reviewDecision
was set. How can one do that?Unfortunately,
PullRequest.reviewDecision
isn't an object with a timestamp, but simply an enum PullRequestReviewDecision.PullRequestTimelineItems
doesn't have anyPullRequestReviewDecision
items unfortunately, so it's not possible to get the timestamp from the timeline either.Edit: I can't find a way to get the date of the last push to the pull request branch, which would help filter the list of approvals since that time, but it doesn't seem like a clean way to do the task as the timeline could look like: push, approve, push, approve, push approve and the 3 approvals would be missed.
Beta Was this translation helpful? Give feedback.
All reactions