How to parse comments in a GIT ad?

I follow simplified code checking procedures for GIT, comments where developers add a message to the GITHUB web interface by saying @review pending by @user_a, @user_b ( user_a and user_b are valid GIT users ) for direct GIT COMMITs.

The reviewer later adds another post to the GITHUB web interface, saying @reviewed by @reviewer_a .

The idea is to determine how many COMMIT has been tested without any reviews. GIT PULL requests are a good place to talk, but I'm looking for every COMMIT message to have a message like @reviewed by... as the last message.

I can list all the commits added to the repository in the last week using git log --oneline --graph --after="1 week ago" . But it does not show comments / posts added from the GITHUB web interface by the requester and reviewers.

Is there a way to list conversations in one COMMIT / parse these conversations / messages added to the GITHUB web interface?

Thanks,

+5
source share
1 answer

Git does not support automatic commenting on comments; that the functionality of github, not git functionality. You will not be able to find the built-in git functionality to see these comments.

As for Git, commits are immutable based on their declaration messages, properties (e.g., author and timestamp), and tree. Making changes to git will necessarily change the hash, which can interfere with anyone who bases their work on an existing commit and its hash. (Git supports roughly equivalent functionality with the git notes command, but GitHub no longer supports showing notes , and capturing comments is not part of this.)

  • If you want to combine the commit in the Git branch with comments made on GitHub, you will need to use the GitHub comment API . . It is impressively documented and should provide you with all the calls you need to list, add, edit or delete comments for any given commit, or list all comments throughout your repo.

    I would suggest some sample code, but your script will depend on your exact browse process, balancing the number of calls you will need (against your GitHub API speed limit) according to the refresh rate you need.

  • If this is part of a constantly running server or review process, you can also examine the commenting event based on a web host that will notify your public endpoint when someone makes a comment. With some persistent storage and a web site, you can easily see when commits make the transition from “sent” to “properly reviewed”.

  • You can also use third-party CLI tools, for example this GitHub CLI project , although I have not used it and cannot vouch for its safety and its usefulness here.
  • Finally, if you are writing your own script, remember to use Git plumbing commands , such as git rev-list instead of git log . The output of porcelain commands (for example, log and status ) can change and evolve, while the plumbing commands (for example, cat-file and rev-list ) guarantee predictable output that is ideal for long-lived scripts.
+3
source

All Articles