Skip to content

fix: update release workflow to prioritize GitHub Release tags - #890

Merged
ericcurtin merged 2 commits into
mainfrom
release-notes-from-last-release
Apr 28, 2026
Merged

fix: update release workflow to prioritize GitHub Release tags#890
ericcurtin merged 2 commits into
mainfrom
release-notes-from-last-release

Conversation

@ilopezluna

Copy link
Copy Markdown
Contributor

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.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@ilopezluna
ilopezluna requested a review from a team April 27, 2026 13:43

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/release.yml Outdated
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
ericcurtin merged commit d4afe7e into main Apr 28, 2026
14 checks passed
@ericcurtin
ericcurtin deleted the release-notes-from-last-release branch April 28, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants