shields icon indicating copy to clipboard operation
shields copied to clipboard

Support filtering by prefix in GitHub latest Release and Tag Badges

Open xingao267 opened this issue 3 years ago • 2 comments

:clipboard: Description

Please see context and discussions at https://github.com/badges/shields/discussions/6253

xingao267 avatar Mar 16 '21 14:03 xingao267

I'd love to see this as well, my reason is mentioned here #7082

rlnt avatar Oct 01 '21 04:10 rlnt

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.

mvndaai avatar Jul 16 '22 07:07 mvndaai

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: Latest tag
  • With prefix modules/docs/: Latest tag

razonyang avatar Feb 04 '23 06:02 razonyang

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

ricardojdsilva87 avatar Feb 22 '23 15:02 ricardojdsilva87

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).

chris48s avatar Jul 03 '23 21:07 chris48s

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)

Image Image

razonyang avatar Jul 04 '23 14:07 razonyang

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.

chris48s avatar Jul 10 '23 15:07 chris48s