shields/blog/2023-07-29-tag-filter.md
Nick Slowinski 7e7a96e210
Add server-2024-05-01
Signed-off-by: Nick Slowinski <nick@nick-slowinski.de>
2024-05-27 06:22:54 +02:00

1,5 KiB

slug title authors tags
tag-filter Applying filters to GitHub Tag and Release badges
name title url image_url
chris48s Shields.io Core Team https://github.com/chris48s https://avatars.githubusercontent.com/u/6025893

We recently shipped a feature which allows you to pass an arbitrary filter to the GitHub tag and release badges. 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.

To give an example of how this might be useful, we create two types of tags on our GitHub repo: https://github.com/badges/shields/tags There are tags in the format major.minor.patch which correspond to our NPM package releases and tags in the format server-YYYY-MM-DD that correspond to our docker snapshot releases.

In our case, this would allow us to make a badge that applies the filter !server-* to filter out the snapshot tags and just select the latest package tag.