Skip to content

Commit 54a79a0

Browse files
authored
fix: optimize latest release tag retrieval in release.yml (#896)
1 parent 2f74a42 commit 54a79a0

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,11 @@ jobs:
6363
BUMP_TYPE: ${{ inputs.bumpType || 'patch' }}
6464
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6565
run: |
66-
# --- Find the latest published GitHub Release tag ---
67-
# Using gh release list instead of git tags ensures we reference the
68-
# last *successfully published* release, not an orphan tag left behind
69-
# by a failed release workflow run.
70-
# - Filter to v* tags only (aligned with the git tag fallback)
71-
# - Use jq's // operator to handle empty arrays (avoids literal "null")
72-
LATEST_RELEASE_TAG=$(gh release list --limit 100 --json tagName \
73-
--jq '[.[] | select(.tagName | startswith("v"))] | sort_by(.tagName) | last | .tagName // ""' \
66+
# --- Find the latest published GitHub Release tag ---
67+
# gh release list defaults to --order desc (newest first by creation
68+
# date), so --limit 1 gives us the most recent release.
69+
LATEST_RELEASE_TAG=$(gh release list --limit 1 --json tagName \
70+
--jq '.[0].tagName // ""' \
7471
2>/dev/null || echo "")
7572
7673
if [ -n "$LATEST_RELEASE_TAG" ]; then

0 commit comments

Comments
 (0)