Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watchers Count is 0 #22

Open
Rucknar opened this issue Jun 26, 2017 · 4 comments
Open

Watchers Count is 0 #22

Rucknar opened this issue Jun 26, 2017 · 4 comments

Comments

@Rucknar
Copy link
Contributor

Rucknar commented Jun 26, 2017

So... V3 API is somewhat strange.

watchers_count actually just shows how many people star the repo
subscribers_count used to show the watchers, seemingly it's been removed more recently from the organisation view and is being deprecated.

Ideally we could find the detail in the V3 app and fix the JSON capture on this app. Alternatively though we could move to the V4 API, this entails interaction with graphql though so would require reasonable amount of refactoring.

@kkirsche
Copy link

kkirsche commented Dec 26, 2018

Query wise, I think you are looking for something like this for repos:

query {
    repository(owner:"prometheus", name:"node_exporter") {
    releases {
      totalCount
    }
    forkCount
    stargazers {
      totalCount
    }
    openIssues:issues(states:OPEN) {
      totalCount
    }
    closedIssues:issues(states:CLOSED) {
      totalCount
    }
    openPullRequests:pullRequests(states:OPEN) {
      totalCount
    }
    closedPullRequests:pullRequests(states:CLOSED) {
      totalCount
    }
    mergedPullRequests:pullRequests(states:MERGED) {
      totalCount
    }
    watchers {
      totalCount
    }
    isArchived
    isFork
    isLocked
    isPrivate
    isMirror
    hasIssuesEnabled
    hasWikiEnabled
    licenseInfo {
      name
    }
    primaryLanguage {
      name
    }
    languages {
      totalCount
    }
    openMilestones:milestones(states:OPEN) {
      totalCount
    }
    closedMilestones:milestones(states:CLOSED) {
      totalCount
    }
    diskUsage
    updatedAt
  }
}

which results in something like:

{
  "data": {
    "repository": {
      "releases": {
        "totalCount": 25
      },
      "forkCount": 646,
      "stargazers": {
        "totalCount": 2315
      },
      "openIssues": {
        "totalCount": 53
      },
      "closedIssues": {
        "totalCount": 462
      },
      "openPullRequests": {
        "totalCount": 10
      },
      "closedPullRequests": {
        "totalCount": 110
      },
      "mergedPullRequests": {
        "totalCount": 572
      },
      "watchers": {
        "totalCount": 141
      },
      "isArchived": false,
      "isFork": false,
      "isLocked": false,
      "isPrivate": false,
      "isMirror": false,
      "hasIssuesEnabled": true,
      "hasWikiEnabled": false,
      "licenseInfo": {
        "name": "Apache License 2.0"
      },
      "primaryLanguage": {
        "name": "Go"
      },
      "languages": {
        "totalCount": 7
      },
      "openMilestones": {
        "totalCount": 1
      },
      "closedMilestones": {
        "totalCount": 2
      },
      "diskUsage": 4985,
      "updatedAt": "2018-12-26T16:18:57Z"
    }
  }
}

This seems to cover the statistics that are in place today, and the ones being requested by other people

@kkirsche
Copy link

kkirsche commented Dec 26, 2018

Updated with a more complete query and fixed the formatting of the data, and setup the syntax highlighting for graphQL and JSON.

@kkirsche
Copy link

kkirsche commented Dec 26, 2018

Let me know if a PR is still of interest @Rucknar or if forking / a new repo would make more sense to build a V4 / GraphQL-based github exporter off of

👍

This will allow multiple repos to be pulled in a single API request

@jlegrone
Copy link

@kkirsche fyi I've been working on a graphql refactor. It's not quite ready for opening a PR yet but you can view the diff here: master...jlegrone:feature/graphql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants