github-exporter icon indicating copy to clipboard operation
github-exporter copied to clipboard

Watchers Count is 0

Open Rucknar opened this issue 8 years ago • 4 comments

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.

Rucknar avatar Jun 26 '17 11:06 Rucknar

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 avatar Dec 26 '18 18:12 kkirsche

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

kkirsche avatar Dec 26 '18 18:12 kkirsche

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

kkirsche avatar Dec 26 '18 19:12 kkirsche

@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: https://github.com/infinityworks/github-exporter/compare/master...jlegrone:feature/graphql

jlegrone avatar Jan 25 '19 19:01 jlegrone