πŸ“Š Count comments on a GitHub issue 🎫

adriens - Sep 25 '22 - - Dev Community

☝️ Why counting comments matters ?

There are two type issues with a lot of comments :

1️⃣ The ones that are popular, then getting a lot of feedback πŸ€—
2️⃣ The ones that have a lot of comments because we struggle to fix them efficiently 😱

πŸ‘‰ In both cases, performing report on them can be helpful to monitor your RUN performances.

❔ Count with API calls

☝️ There actually is no native gh issue command to count issues on a specific command...

πŸ‘‰ but gh api...

"Makes an authenticated HTTP request to the GitHub API and prints the response."

gh api <endpoint> [flags]
Enter fullscreen mode Exit fullscreen mode

πŸ’‘ This short post is documenting how easy it is to count comments on a given issue.

πŸ€“ Snippet

gh api -X GET \
  -H "Accept: application/vnd.github.v3+json" \
  -F per_page=100 \
  /repos/YOUR_ORGA/REPO/issues/ISSUEID/comments | \
  jq '. | length'
Enter fullscreen mode Exit fullscreen mode

Image description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player