fix: update release workflow to prioritize GitHub Release tags - #890
Merged
Conversation
Contributor
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The step now assumes
ghis available, but on runners without the GitHub CLI this will fail before|| echo ""is evaluated; consider guarding withcommand -v gh >/dev/nullor a similar check and skipping to the git-tag fallback ifghis missing. - The GitHub release lookup does not filter by the
v*pattern, while the git tag fallback does; if non-v*releases exist this could change the tag selection semantics, so consider aligning the filtering logic betweengh release listandgit tag.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The step now assumes `gh` is available, but on runners without the GitHub CLI this will fail before `|| echo ""` is evaluated; consider guarding with `command -v gh >/dev/null` or a similar check and skipping to the git-tag fallback if `gh` is missing.
- The GitHub release lookup does not filter by the `v*` pattern, while the git tag fallback does; if non-`v*` releases exist this could change the tag selection semantics, so consider aligning the filtering logic between `gh release list` and `git tag`.
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="73-75" />
<code_context>
- LATEST_TAG=$(git tag --list 'v*' --sort=-v:refname | head -1)
- echo "Latest existing tag: ${LATEST_TAG:-<none>}"
+ # --- Find the latest published GitHub Release tag ---
+ LATEST_RELEASE_TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null || echo "")
+
+ if [ -n "$LATEST_RELEASE_TAG" ]; then
+ LATEST_TAG="$LATEST_RELEASE_TAG"
+ echo "Latest published GitHub Release tag: $LATEST_TAG"
</code_context>
<issue_to_address>
**issue:** Handle the case where `gh release list` returns an empty array to avoid `LATEST_RELEASE_TAG` being set to `null`.
`gh release list --json tagName --jq '.[0].tagName'` will still exit 0 and print the literal string `null` when there are no releases, so the `|| echo ""` fallback won’t run and `LATEST_RELEASE_TAG` becomes `"null"`. Consider treating `null` as empty in the jq expression:
```bash
LATEST_RELEASE_TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName // ""' 2>/dev/null || echo "")
```
or normalizing after the call:
```bash
[ "$LATEST_RELEASE_TAG" = "null" ] && LATEST_RELEASE_TAG=""
```
so the git tag fallback still works when there are no GitHub releases.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Address review feedback from PR #890: - Use jq's // operator to handle empty arrays (avoids literal "null" when no GitHub Releases exist, ensuring the git tag fallback works) - Filter gh release list to v* tags only (aligned with the git tag fallback filtering logic) - Add explanatory comments for the approach
ericcurtin
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the release workflow to improve how the latest release tag is determined. The workflow now prioritizes the latest published GitHub Release tag, falling back to the latest git tag only if no GitHub Releases exist.
This is to ensure release notes are built from latest published release.