Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Fix README version badge 404 by escaping the dash in the alpha suffix and collapsing it back in the VERSION-sync hook
Murtaza Nasir787f088063ef
diff --git a/README.md b/README.mdindex 63ea6036..777c0cb5 100644--- a/README.md+++ b/README.md@@ -9,7 +9,7 @@<a href="https://www.gnu.org/licenses/agpl-3.0"><img alt="AGPL v3" src="https://img.shields.io/badge/License-AGPL_v3-blue.svg"></a><a href="https://github.com/murtaza-nasir/speakr/actions/workflows/docker-publish.yml"><img alt="Docker Build" src="https://github.com/murtaza-nasir/speakr/actions/workflows/docker-publish.yml/badge.svg"></a><a href="https://hub.docker.com/r/learnedmachine/speakr"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/learnedmachine/speakr"></a>- <a href="https://github.com/murtaza-nasir/speakr/releases/latest"><img alt="Latest Version" src="https://img.shields.io/badge/version-0.9.5-alpha-brightgreen.svg"></a>+ <a href="https://github.com/murtaza-nasir/speakr/releases/latest"><img alt="Latest Version" src="https://img.shields.io/badge/version-0.9.5--alpha-brightgreen.svg"></a></p><p align="center">diff --git a/scripts/pre-commit b/scripts/pre-commitindex 77667610..4a60749c 100755--- a/scripts/pre-commit+++ b/scripts/pre-commit@@ -36,9 +36,13 @@ fiif echo "$STAGED_FILES" | grep -qE '^(README\.md|VERSION)$'; thenif [ -f README.md ] && [ -f VERSION ]; then# Extract version from README badge. Accepts X.Y.Z or X.Y.Z-suffix.+ # A literal dash in the version (e.g. the "-alpha" suffix) is escaped+ # as "--" in the shields.io badge so the badge renders instead of+ # 404ing; collapse it back to a single dash for the VERSION file.README_VER=$(grep -oE 'shields\.io/badge/version-[0-9]+\.[0-9]+\.[0-9]+[A-Za-z0-9.-]*-[a-z]+\.svg' README.md \| head -1 \- | sed -E 's|shields\.io/badge/version-([0-9]+\.[0-9]+\.[0-9]+[A-Za-z0-9.-]*)-[a-z]+\.svg|\1|')+ | sed -E 's|shields\.io/badge/version-([0-9]+\.[0-9]+\.[0-9]+[A-Za-z0-9.-]*)-[a-z]+\.svg|\1|' \+ | sed 's|--|-|g')if [ -z "$README_VER" ]; thenecho "Version-sync skipped: could not parse version from README badge."