DEV Community

Discussion on: 📊 Count comments on a GitHub issue 🎫

Collapse
 
jnv profile image
Jan Vlnas

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.

Collapse
 
adriens profile image
adriens

Hmmm, that looks pretty interesting indeed !

"comments": 0,

Collapse
 
adriens profile image
adriens

Here we go, and thanks a lot for having pointed this to us, see that trick @mbarre :

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

... I could get :

149

within a single shot 😊