Fix backport workflow to filter out beta/rc tags (#2294)
authorMarvin Schenkel <marvinschenkel@gmail.com>
Fri, 8 Aug 2025 09:30:25 +0000 (11:30 +0200)
committerGitHub <noreply@github.com>
Fri, 8 Aug 2025 09:30:25 +0000 (11:30 +0200)
The workflow was failing because it selected beta tags (e.g., 2.6.0b3)
instead of stable tags (e.g., 2.5.5) when calculating the next patch version.
Now filters tags to only match stable version format.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
.github/workflows/backport-to-stable.yml

index 5c461c85f8cd5300b38e40367159bb556b83ab03..8e1e768d3f85cbc33c116da8295a1be048e7bd5e 100644 (file)
@@ -63,12 +63,13 @@ jobs:
         id: nextver
         run: |
           git fetch origin stable --tags
-          latest_tag=$(git tag --merged origin/stable --sort=-v:refname | head -1)
+          # Filter out beta/rc tags and get only stable versions (e.g., 2.5.5, v2.5.5)
+          latest_tag=$(git tag --merged origin/stable --sort=-v:refname | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | head -1)
           if [[ -z "$latest_tag" ]]; then
-            echo "No tags found on stable branch" >&2
+            echo "No stable tags found on stable branch" >&2
             exit 1
           fi
-          echo "Latest tag: $latest_tag"
+          echo "Latest stable tag: $latest_tag"
 
           # Remove 'v' prefix if present
           version="$latest_tag"