File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -66,19 +66,30 @@ actions:
6666 run : |
6767 #!/usr/bin/env bash
6868 set -e
69+
70+ # Check if we're on main or master branch
6971 if git rev-parse --abbrev-ref HEAD | grep -q 'main\|master'; then
70- TAG=$(git describe --tags --exact-match "$(git log -n1 --pretty='%h')" 2>/dev/null || echo "")
71- if [ -z "$TAG" ]; then
72- echo "No tag found for the current commit. Skipping tag-version check."
72+ # Try to get the tag for the current commit, ignore errors
73+ TAG=$(git describe --tags --exact-match "$(git log -n1 --pretty='%h')" 2>/dev/null || true)
74+
75+ # If no tag found, skip validation entirely
76+ if [ -z "$TAG" ]; then
77+ echo "No tag found for the current commit - skipping version validation."
7378 exit 0
74- fi
75- VERSION=$(grep '^version =' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
79+ fi
80+
81+ # Validate it matches pyproject.toml version
82+ VERSION=$(grep '^version =' pyproject.toml | sed -E 's/version = "(.*)"/\1/' 2>/dev/null || echo "")
83+
7684 if [ "$TAG" != "$VERSION" ]; then
7785 echo "Tag '$TAG' does not match version '$VERSION' in pyproject.toml."
7886 exit 1
7987 fi
88+
89+ echo "Tag '$TAG' matches version '$VERSION'."
90+ else
91+ echo "Not on main/master branch - skipping tag validation."
8092 fi
81- echo "Tag matches version."
8293 exit 0
8394tools :
8495 enabled :
You can’t perform that action at this time.
0 commit comments