shields
shields copied to clipboard
Support filtering by prefix in GitHub latest Release and Tag Badges
:clipboard: Description
Please see context and discussions at https://github.com/badges/shields/discussions/6253
I'd love to see this as well, my reason is mentioned here #7082
I want this for having multiple go packages with their own go.mod
files within the same repo. Go allows versioning the subpackages by tagging like subfolder/v0.0.1
. I would like to show badges for each subpackage in a table on the readme. That is why I made that PR ^.
The only issue I have in the PR is that the code already limits to getting 100 tags when sorting so if one subpackage is never updated and others have more that 100 releases then the filter might not work.
Hi, is there any updates? Need this for Go modules in same repo.
EDITED:
Just wrote a simple public API for this, hope it helps.
![Latest tag](https://img.shields.io/badge/dynamic/json?color=blue&label=tag&query=name&url=https://api.razonyang.com/v1/github/tag/USER/REPO)
![Latest tag](https://img.shields.io/badge/dynamic/json?color=blue&label=tag&query=name&url=https://api.razonyang.com/v1/github/tag/hbstack/blog)
![Latest tag](https://img.shields.io/badge/dynamic/json?color=blue&label=tag&query=name&url=https://api.razonyang.com/v1/github/tag/hbstack/blog%3Fprefix=modules%2Frelated-posts%2F)
- Without prefix:
- With prefix
modules/docs/
:
Hello, this feature would be really helpfull. On the README we have we are checking for releases for an helm chart for example for argoCD. https://github.com/argoproj/argo-helm/releases In this case we have several different helm releases for the different argocd components, like events, workflows, etc. It would be usefull if we can have some kind of regex filter to show for example per date the release for argo-events-* or argo-cd-*.
Another example would be for Datadog that has several different components: https://github.com/DataDog/helm-charts/releases
This way we could monitor different components in the same repo. Keep up the good work! Thanks
Hello. We have just shipped a new feature which allows you to pass an arbitrary filter to the github tag and release badges. For example
The filter
param can be used to apply a filter to the project's tag or release names before selecting the latest from the list. Two constructs are available: *
is a wildcard matching zero or more characters, and if the pattern starts with a !
, the whole pattern is negated.
e.g: https://img.shields.io/github/v/tag/badges/shields https://img.shields.io/github/v/tag/badges/shields?filter=%21server-%2A
This feature should be powerful and flexible enough to enable this use-case (and a bunch of others).
Hi @chris48s, is there an option to transform/truncate the tag name/label, in some context, the prefix (modules/socials
) is redundant, I want to display the version only, i.e. v0.1.2
.
![Image](https://img.shields.io/github/v/tag/hbstack/header?filter=modules/socials%2A)
![Image](https://img.shields.io/github/v/tag/hbstack/header?filter=modules/search%2A)
No the tag badge will always just display the text of the tag. For releases you can pick either the tag name or the release name.