metacpan / metacpan-api

A free, open API for everything you want to know about CPAN
http://www.metacpan.org/
Other
291 stars 195 forks source link

Add GitHub stars to /distribution #1293

Open oalders opened 1 month ago

oalders commented 1 month ago

We're already doing something like this for https://fastapi.metacpan.org/distribution/App-perlimports:

{
   "name" : "App-perlimports",
   "bugs" : {
      "github" : {
         "active" : 10,
         "open" : 10,
         "closed" : 105,
         "source" : "https://github.com/perl-ide/App-perlimports"
      }
   },
   "river" : {
      "total" : 0,
      "bucket" : 0,
      "immediate" : 0,
      "bus_factor" : 1
   }
}

If we could add GitHub stars (and watchers?) to the this endpoint we could easily incorporate that into the front end without the extra GitHub requests. Hopefully that would encourage more people to star the repository in question.

haarg commented 1 month ago

The graphql for this:

query {
    repository(owner: %s, name: %s) {
        stargazerCount: stargazerCount
        watchers: watchers {
            totalCount
        }
    }
}

Could be added to the tickets script rather easily.

mickeyn commented 1 month ago

We should be able to add it to the GitHub GraphQL query if it supports this info.