Closed kroese closed 4 months ago
It can be fetched with not Docker Registry API but GitHub GraphQL API.
https://docs.github.com/en/graphql/reference/objects#packagestatistics
https://docs.github.com/en/graphql/reference/objects#packageversionstatistics
But I think it is out of scope this badge service for now. If you want to use this feature, please send your PR. I'll welcome.
This will be awesome!
+1 for this feature, most of the users of my images prefer to use GHCR than Docker Hub, the number of downloads is almost surpassing Docker Hub's.
It can be fetched with not Docker Registry API but GitHub GraphQL API.
https://docs.github.com/en/graphql/reference/objects#packagestatistics
https://docs.github.com/en/graphql/reference/objects#packageversionstatistics
GraphQL Query for repo packages seems dead due to deprecation. https://github.blog/changelog/2022-08-18-deprecation-notice-graphql-for-packages/
And I confirmed these queries are currently not working.
Sadly, there does not seem to be a replacement for PackageVersionStatistics
in the REST API.
https://docs.github.com/en/free-pro-team@latest/rest/packages/packages?apiVersion=2022-11-28
What about parsing HTML other than using API as a provisional solution?
This now implemented in: https://github.com/ipitio/badpack
It would be nice to have a badge that display the total pulls count, like is possible with Dockerhub badges. I dont know if GHCR provides this information, or that it is only available per image. In that case the badge would need to sum up all values, but that might be too resource-intensive.