From 1bfda7a54b79b0f0fddfb65fa6a469485e04c404 Mon Sep 17 00:00:00 2001 From: chris48s Date: Mon, 31 Jul 2023 12:21:55 +0100 Subject: [PATCH] add a blog post about GH Tag/Release filter param (#9424) * add a blog post about GH Tag/Release filter param * Update frontend/blog/2023-07-29-tag-filter.md Co-authored-by: Caleb Cartwright --------- Co-authored-by: Caleb Cartwright --- frontend/blog/2023-07-29-tag-filter.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 frontend/blog/2023-07-29-tag-filter.md diff --git a/frontend/blog/2023-07-29-tag-filter.md b/frontend/blog/2023-07-29-tag-filter.md new file mode 100644 index 0000000000..7bb863e2ef --- /dev/null +++ b/frontend/blog/2023-07-29-tag-filter.md @@ -0,0 +1,19 @@ +--- +slug: tag-filter +title: Applying filters to GitHub Tag and Release badges +authors: + name: chris48s + title: Shields.io Core Team + url: https://github.com/chris48s + image_url: https://avatars.githubusercontent.com/u/6025893 +tags: [] +--- + +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](https://www.npmjs.com/package/badge-maker?activeTab=versions) and tags in the format `server-YYYY-MM-DD` that correspond to our [docker snapshot releases](https://registry.hub.docker.com/r/shieldsio/shields/tags?page=1&ordering=last_updated). + +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. + +- ![tag badge without filter](https://img.shields.io/github/v/tag/badges/shields) - https://img.shields.io/github/v/tag/badges/shields +- ![tag badge with filter](https://img.shields.io/github/v/tag/badges/shields?filter=%21server-%2A) - https://img.shields.io/github/v/tag/badges/shields?filter=%21server-%2A