GitHub v4 API: Calculate content specific reaction count on a comment

143 Views Asked by At

I am trying to get the reaction count for each content using the Github v4 API (GraphQL). Can anyone suggest how can I achieve this?

Github supports the following reactions:

THUMBS_UP
THUMBS_DOWN
LAUGH
HOORAY
CONFUSED
HEART
ROCKET
EYES

For each reaction, I want a count which denotes the number of people who reacted. For eg. I am referring to this comment -> #2190.

1

There are 1 best solutions below

0
On BEST ANSWER

Github API provides a feature called reaction group. Refer to the following query...

{
  repository(owner: "sindresorhus", name: "refined-github") {
    issue(number: 2190) {
      reactionGroups {
        content
        users {
          totalCount
        }
      }
    }
  }
}

Hope this solves your problem!