You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add relevant metadata to issue view and pr view #663
Describe the feature or problem you’d like to solve
When using the terminal view for gh issue view and gh pr view (currently requiring the --preview flag but soon to be the default), there's a lot of metadata that does not show up in the output that would be helpful to people.
Proposed solution
Mirroring most of the information in the issue/PR sidebar seems sensible as a starting point, but I have no opinion about how it should be presented.
@doi-t Since this is in line with the things you've been contributing to date, do you have interest in picking this up? Please don't feel any obligation whatsoever, but we wanted to give you the first opportunity since you've recently worked on similar things and have made such valuable contributions.
Never mind! I guess #663 (comment) is an example of no milestone which follows a note (When a field is empty, don't display it) and we want to show a milestone title
Hi @doi-t, yes you figured that out exactly right! Apologies for that not being immediately clear 🙇♀
Could you please assign you and me to this issue? 🙏 Then, this issue can be an example of multiple assignees for gh issue view 663 --repo cli/cli
I can do this!
Does Github GraphQL API v4 already support Linked pull requests and Linked issues? IIRC, it is a relatively new feature on github.com 🤔
@mislav@vilmibm should be able to give you a better answer on that! From my perspective, if it's not easy to implement then I'm totally fine leaving it out for now.
@ampinsk Thank you for your guide and the issue assignment! 😄
Reviewers in pr view
I made a PR #748 for pr view. Through the implementation, I realized that we haven't discussed Reviewers and its state, which is the most useful metadata for me at least. 🤩
Design Perspective
@ampinsk
Following the basic principle of mirroring GitHub.com in CLI preview, I assume that we basically want to copy what Web UI does. As far as I know, we see 4 types of reviewers' state along with a short message in Web UI. How should I display the state of reviewers in CLI? My quick thought is foo (Approved), bar (Changes requested) just like Projects. Please let me know if my assumption and understanding are wrong. 🙇
Technical Perspective
@mislav@vilmibm
It seems that Reviewers is more complicated than other metadata. There are ReviewRequest and PullRequestReview. If I understand it correctly, we need to individually calculate both requested reviewers (RequestedReviewer) and the latest state of reviewers (APPROVED, CHANGES_REQUESTED, COMMENTED and others).
I tried to collect reviewers' information with doi-t/cli@85d8f80...doi-t:8fca78f and turned out that it also includes the history of reviews besides above multiple factors.
Below partial JSON data is an example of ReviewRequests. We receive it only when someone requests a review.
Below partial JSON data is an example of gh pr view 667 --repo cli/cli. In this case, no one made a review request but the code review happened so that ReviewRequests is empty but Reviews has its history. As you can see below, last 3 events was one COMMENTED by the author which is not relevant as metadata and two APPROVED by the same reviewer which is duplicated information in terms of pr view. It also means that we need to look back at the review history as much as possible and calculate the latest states of each reviewer if there is no way to filter them.
Based on above understandings, the idea I can come up with is:
Query ReviewRequests and Reviews (e.g. last: 100)
List up unique reviewers from ReviewRequests and Reviews and remove the PR author
Generate reviewer list with the last state (e.g. foo (Approved), bar (Changes requested))
If there are more than, for example, 3 reviewers, display the first 3 reviewers with their last state
My understanding and approach itself could be wrong so that I appreciate your guide. 🙇 I'm really curious how GitHub.com internally calculate the latest state of reviewers for the Web UI. 🤔
Activity
ampinsk commentedon Mar 18, 2020
Here's where we landed on how to display sidebar info!
Some notes:
billygriffin commentedon Mar 23, 2020
@doi-t Since this is in line with the things you've been contributing to date, do you have interest in picking this up? Please don't feel any obligation whatsoever, but we wanted to give you the first opportunity since you've recently worked on similar things and have made such valuable contributions.
doi-t commentedon Mar 24, 2020
@billygriffin
Yay! Thank you for the opportunity! 😄I'm definitely interested in it. Will work on it. 🙌
doi-t commentedon Apr 2, 2020
@billygriffin
I have some things to make sure:
Don't we want to showMilestonetitle as metadata as well?When a field is empty, don't display it) and we want to show a milestone titlegh issue view 663 --repo cli/cliLinked pull requestsandLinked issues? IIRC, it is a relatively new feature on github.com 🤔ampinsk commentedon Apr 2, 2020
Hi @doi-t, yes you figured that out exactly right! Apologies for that not being immediately clear 🙇♀
I can do this!
@mislav @vilmibm should be able to give you a better answer on that! From my perspective, if it's not easy to implement then I'm totally fine leaving it out for now.
doi-t commentedon Apr 4, 2020
@ampinsk Thank you for your guide and the issue assignment! 😄
Reviewersinpr viewI made a PR #748 for
pr view. Through the implementation, I realized that we haven't discussedReviewersand its state, which is the most useful metadata for me at least. 🤩Design Perspective
@ampinsk
Following the basic principle of mirroring GitHub.com in CLI preview, I assume that we basically want to copy what Web UI does. As far as I know, we see 4 types of reviewers' state along with a short message in Web UI. How should I display the state of reviewers in CLI? My quick thought is
foo (Approved), bar (Changes requested)just likeProjects. Please let me know if my assumption and understanding are wrong. 🙇Technical Perspective
@mislav @vilmibm
It seems that
Reviewersis more complicated than other metadata. There are ReviewRequest and PullRequestReview. If I understand it correctly, we need to individually calculate both requested reviewers (RequestedReviewer) and the latest state of reviewers (APPROVED,CHANGES_REQUESTED,COMMENTEDand others).I tried to collect reviewers' information with doi-t/cli@85d8f80...doi-t:8fca78f and turned out that it also includes the history of reviews besides above multiple factors.
Below partial JSON data is an example of
ReviewRequests. We receive it only when someone requests a review.Below partial JSON data is an example of
gh pr view 667 --repo cli/cli. In this case, no one made a review request but the code review happened so thatReviewRequestsis empty butReviewshas its history. As you can see below, last 3 events was oneCOMMENTEDby the author which is not relevant as metadata and twoAPPROVEDby the same reviewer which is duplicated information in terms ofpr view. It also means that we need to look back at the review history as much as possible and calculate the latest states of each reviewer if there is no way to filter them.(Relevant discussion: https://github.community/t5/GitHub-API-Development-and/How-to-retrieve-PR-reviewers-with-GraphQL-API/m-p/20974)
Based on above understandings, the idea I can come up with is:
ReviewRequestsandReviews(e.g. last: 100)ReviewRequestsandReviewsand remove the PR authorfoo (Approved), bar (Changes requested))My understanding and approach itself could be wrong so that I appreciate your guide. 🙇 I'm really curious how GitHub.com internally calculate the latest state of reviewers for the Web UI. 🤔
doi-t commentedon Apr 5, 2020
📝 Found relevant implementations:
Logic wise, it seems it is fine to overwrite reviewer's last states of
ReviewsbyReviewRequests.Will try to make a proof of concept to see the actual logic in Go. 👀
doi-t commentedon Apr 7, 2020
@ampinsk @billygriffin
I made another PR for
Reviewers#762. Please take a look at it when you have time.Here is the things needs to be confirmed for the design:
Participantsforgh view issueAdd relevant metadata to issue view in CLI #745 andgh view prAdd relevant metadata to pr view in CLI #748 (Shall we?)ReviewersAdd Reviewers to pr view in CLI #762ampinsk commentedon Apr 7, 2020
@doi-t Thanks for the clear questions!
Approved: Green
Changes requested: Red
Commented: No color
Requested: Yellow