badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.65k stars 5.49k forks source link

flakehub.com #9551

Open yajo opened 1 year ago

yajo commented 1 year ago

📋 Description

There's a new service https://flakehub.com/ to add SemVer support for Nix flakes.

It would be great to have a badge that displayed the latest version published in that site.

🔗 Data

There seems to be an API, because the public site is actually using it to display its content. Examples:

I can't find any docs. I opened https://github.com/DeterminateSystems/fh/issues/24 about this.

🎤 Motivation

Encouraging installing packages through stable releases in nix flake format.

chris48s commented 1 year ago

This does seem like a reasonable service to add a badge for :+1: I'd like to get a confirmation that this is a public API we are OK to use first.

lucperkins commented 1 year ago

@chris48s I'm an engineer on FlakeHub and this is indeed a public API! I'll take a look at your docs and see what this would involve.

lucperkins commented 1 year ago

@chris48s Okay, I have an internal PR open that enables you to make a request to

https://api.flakehub.com/f/:org/:project/badge

and get back JSON like this:

{
  "schema_version": 1,
  "label": "FlakeHub",
  "message": "23.5.490090", // The latest version of the flake
  "color": "rgb(33,29,82)" // Our brand purple
}

Is this roughly workable for an integration?

chris48s commented 1 year ago

If you want to provide your own badges by publishing an endpoint and using the endpoint badge that is the right schema.

For adding badges to shields.io. we prefer just use the standard public API tbh. For example, I can see that if I call https://api.flakehub.com/f/copier-org/copier we've also got an spdx_identifier field, which would allow us to add a FlakeHub license badge as well, without you needing to add an additional endpoint. There are also some design decisions we prefer to hard-code or standardise for badges that live on shields.io itself, like we wouldn't use a brand colour for a version badge. We'd use our standard scheme: blue for stable, orange for pre-release. Users are, of course, welcome to override that.

What would be useful, in lieu of some docs, would be some guidance.

If I call https://api.flakehub.com/f/copier-org/copier for example, I can see that I've got 2 version fields:

It would be useful to understand:

Thanks