-
Notifications
You must be signed in to change notification settings - Fork 13
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
Pulling Request Comment via GitHub REST API #323
Comments
Quick questions on the specification of this issue:
|
No, this is an API request to download data. It is closer to @daomcgill if anything, but she is not using API. You should look at the pull request for GitHub. It has many examples on how to write R code to download data. Please follow the format already used on github.R (i'd recommend trying the notebook from a user perspective too and downloading some data). Again see the PR, the GitHub code has not been merged yet). @crepesAlot pinging you here so you are aware too. |
Taking a glance at the github.R PR, it's not well-documented but I'll report back what I can scrounge up of what I understand. If this is not the file you were meaning for me to look at, let me know. Also, I have also been in communication with @daomcgill about making this refresher function, so I'm currently forwarding questions to her via Discord. |
not exec/github.R, look at R/github.R and the associated notebook. @beydlern should have revised it. |
also please collaborate closely with @crepesAlot once either of you understand how it has been done, explaining to the other will save a lot of your time. |
@RavenMarQ
|
Look at vignettes/download_github_comments.Rmd. The effort in this task should be very minimal and non code related, since you are not writing the GitHub API interface from scratch like @beydlern is doing with OpenHub. There is already a lot of code written to interact with GitHub API. Just see how the API endpoint looks like in R/github.R for one endpoint, and literally copy and paste the code and change the url and adapt the documentation. Then you need to write the parser for the downloaded json, which is something you're familiar with from having to do the XML. In hindsight, @beydlern is the closest task equivalent to yours, since he is also using an API. I'd hope the R/github.R code suffices to give a template on how to do that. |
@crepesAlot when you can please ask Raven to update this issue specification. For now i'd recommend at least keep track on a comment here, and I can hyperlink the first comment until the final version is done. |
@carlosparadis Here's the main points that are retrieved from this endpoint. |
@carlosparadis I have tried testing what you asked about how the information for the |
Ah yes, another GitHub mystery! Why here my comment appear twice in the table? And #323 (comment) What is the docs definition for this diff hunk? |
@carlosparadis Those are 2 different comments, the comment in the screenshot of the pull request is the last row in the table. So I looked into the response JSON some more and I found 4 fields that may be of interest: start_line, line, original_start_line, and original_line
The start_line and line fields will return null if any subsequent commits delete the line the comment was referring to. Here's an example screenshot. |
- Updated `vignetts/download_github_comments.Rmd` - Added pull request comments to parse_github_replies function to `R/github.R` - Added new getter function to `R/config.R` - Updated configuration files with new file paths to save data from new endpoint
@crepesAlot remind me again, was this ready for review or was there anything pending? |
@carlosparadis I just need to update the function documentation for more in depth explanation and details on the different fields. |
Sounds good, send me the request for code review when ready! |
- Updated notebook to include section on where to place created tokens to use endpoints. - Updated pr_comments function documentation
@carlosparadis I updated the function documentations and NEWS.md, the code review should be good to go! |
- Made refresh function to use function parameter for the save_folder_path instead of a pre-assigned variable. - Updated various verbose print statements
@carlosparadis I was able to find what connects the Pull Request Comment endpoint (this issue's endpoint) with the Pull Request Review endpoint. |
- Retrieves `pull_request_review_id` from JSON file to refer to the review comment made when creating the review.
Purpose
As of now, users are able 2 different endpoints to extract data from pull requests (pull_request and issue_or_pr_request). However, neither of the endpoints extract the in-line comments from pull requests, which can be a point of interest for the user to study.
While the
GET /repos/{owner}/{repo}/issues/comments/
endpoint does retrieve the comments for pull requests, it does not retrieve the in-line code.Process
To extract this data, we can use an endpoint from Github's REST API.
The particular endpoint being used is:
GET /repos/{owner}/{repo}/pulls/comments
The documentation for this endpoint can be found on the Github Page.
The field
"diff_hunk":
is a field unique to this particular endpoint and is what contains the in-line code that the pull request comment is referencing. The diff_hunk field refers to the hunk of code in pull requests that contain the +/- changes made to a particular file. If the comment is referencing a line of code within a hunk, the diff_hunk will contain all lines of code from the start of the hunk, ending with the line of code the comment is referencing.The diff_hunk field will return null if the review comment was not referencing any lines of code.
The
pull_request_review_id
field returns an integer value that ties the comment to the the Review endpoint.A parser function will also be needed to turn the resulting JSON file into a more readable table.
Task List
diff_hunk
field to retrieve the in-line codeLimitations
This issue implements the pull request Comments endpoint url
We noticed that the process of requesting changes or accepting review, the associated comment with accept/reject is not captured as a review comment in this endpoint.
The Review Endpoint comment for accept/reject groups the comments obtained by the Review Comment endpoint.
https://api.github.com/repos/sailuh/kaiaulu/pulls/295/reviews
The text was updated successfully, but these errors were encountered: