GitHub allows me to subscribe to issues but does the GitHub API allow me to determine the count of subscribers to an issue?
My thinking is that if the subscriber count were exposed it could be a form of voting for an issue. Right now, you often see people "voting" for issues by adding a "+1" or similar comment, which can clutter up an issue.
(There have been calls for an explicit +1
feature for issues that isn't a comment and browser extensions developed to declutter issues.)
I checked https://developer.github.com/v3/issues/ and it doesn't seem like determining the count of subscribers to an issue is currently possible, unfortunately.
As the Github's API have not the exact feature that you are looking for, it is possible to fetch the data and look for suscribed
events from the Issues Events API https://developer.github.com/v3/issues/events/
GET /repos/:owner/:repo/issues/:issue_number/events
Will fetch the list of events for particular issue, there you can check for subscribed
values on the event
field.
You can now use Github graphql API to get the count of thumbs up (+1) 👍 reaction :
{
repository(owner: "isaacs", name: "github") {
issue(number: 9){
reactions(content: THUMBS_UP){
totalCount
}
}
}
}
Output:
{
"data": {
"repository": {
"issue": {
"reactions": {
"totalCount": 227
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With