19

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.

Philip Durbin
  • 4,042
  • 2
  • 25
  • 36
  • this is not possible Phillip. the closest thing you could do is a webhook to filter events for `watch`, but that wouldn't count how many people were mentioned. So a pretty hard one. – bitoiu Jun 22 '15 at 04:35
  • I think github won’t ever make the subscribers listing or even count public because that could be construed to be a privacy issue. Also, they won’t want to implement voting because they just don’t want to :-(. – binki Jul 12 '15 at 16:56
  • 2
    How is the number of subscribers a privacy issue? Could it be mitigated in another way like a profile option "Do not publicly count my issue subscriptions"? I think it's really obvious that we need a feature like this, +1 comments are a PiTA on popular issues, and yet there's no other way to show demand for a fix. – chrishiestand Nov 23 '15 at 20:43
  • Octokit can be valuable for accessing GitHub metadata: http://stackoverflow.com/questions/25717753/get-user-events-with-github-api-and-octokit – JustBeingHelpful Jan 30 '16 at 20:36

2 Answers2

4

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.

  • 1
    Does this work? I just clicked "Subscribe" on https://github.com/isaacs/github/issues/408 but I don't see my subscription with `curl https://api.github.com/repos/isaacs/github/issues/408/events | jq '.[] | select(.event=="subscribed")` – Philip Durbin Aug 18 '15 at 10:38
  • Very weird. Is not showing all events, just a few. Checked and is not a pagination issue. Oh look, seems some subscriptions events are fired in the repository events list. `GET /repos/:owner/:repo/issues/events` Let me know if you can find your subscribed event there and I'll update the answer to describe it correctly – Daniel Aristizabal Aug 18 '15 at 14:59
1

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
        }
      }
    }
  }
}

enter image description here

Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159