☝️ 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]
💡 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'
Top comments (4)
Thanks for the tip!
I can't wrap my head around one thing, though: wouldn't that count comments only up to 100, as more comments would be paginated? 🤔
I wonder if issue endpoint would be better for this task, as it seems to contain
comments
property with the comments count.Here we go, and thanks a lot for having pointed this to us, see that trick @mbarre :
... I could get :
149
within a single shot 😊
Hmmm, that looks pretty interesting indeed !
"comments": 0,