From fc698e004e9468b4fb6248f8e54ebabff0fe7eac Mon Sep 17 00:00:00 2001 From: Sufien Tout Date: Wed, 18 Dec 2024 14:29:09 -0500 Subject: [PATCH] meta: do not create tag when there are no public changes --- .github/scripts/tag.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/scripts/tag.sh b/.github/scripts/tag.sh index 7c0f24d3..bae420fe 100755 --- a/.github/scripts/tag.sh +++ b/.github/scripts/tag.sh @@ -2,12 +2,31 @@ set -e +tag_has_public_changes=false + +previous_tag=$(git describe --tags --abbrev=0 HEAD~) + +# Enable case-insensitive matching +shopt -s nocasematch + +# Loop through all commits since previous tag +for rev in $(git log "$previous_tag"..HEAD --format="%H" --reverse --no-merges); do + summary=$(git log "$rev"~.."$rev" --format="%s") + # Exclude commits starting with "Meta" + if [[ $summary != Meta* ]]; then + tag_has_public_changes=true + break + fi +done + head_tag=$(git describe --exact-match 2>/dev/null || true) git log --color=always --format="%C(auto)%h %s%d" | head -if [[ ${head_tag} =~ [\d{2}\.\d{2}\.\d+] ]] -then +if ! $tag_has_public_changes; then + echo "No public changes since $previous_tag." >&2 + exit 1 +elif [[ ${head_tag} =~ [\d{2}\.\d{2}\.\d+] ]]; then echo "Version tag ${head_tag} already exists." else git config --local user.email "github-actions@users.noreply.github.com"