Skip to content

Commit

Permalink
meta: do not create tag when there are no public changes
Browse files Browse the repository at this point in the history
  • Loading branch information
suft committed Dec 18, 2024
1 parent 755b3dd commit 67a1aad
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/scripts/tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@

set -e

tag_has_public_changes=false

previous_tag=$(git describe --tags --abbrev=0 HEAD~)

# 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 "[email protected]"
Expand Down

0 comments on commit 67a1aad

Please sign in to comment.