release: validate tag version before publish#286
release: validate tag version before publish#286brianmhunt merged 1 commit intopc/release_taggingfrom
Conversation
📝 WalkthroughWalkthroughA validation step was added to the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai please review |
🧩 Analysis chain🏁 Script executed: Length of output: 5505 🏁 Script executed: Length of output: 1134
✅ What looks good
🔍 Suggestions1. Unquoted gh release create "$tag" \
--repo "$GITHUB_REPOSITORY" \
--target "$TARGET_SHA" \
--title "TKO ${VERSION}" \
--generate-notes \
$prerelease_flag # <-- unquotedThis works correctly in bash (an empty variable expands to nothing, adding no extra argument), but ShellCheck will flag it. To silence it cleanly: gh release create "$tag" \
--repo "$GITHUB_REPOSITORY" \
--target "$TARGET_SHA" \
--title "TKO ${VERSION}" \
--generate-notes \
${prerelease_flag:+$prerelease_flag}Or simply use an array: release_args=(
"$tag"
--repo "$GITHUB_REPOSITORY"
--target "$TARGET_SHA"
--title "TKO ${VERSION}"
--generate-notes
)
[ -n "$prerelease_flag" ] && release_args+=("$prerelease_flag")
gh release create "${release_args[@]}"2. Consider an early-exit validation job (optional enhancement) Currently, validate-tag:
name: Validate Tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: 24.x
- name: Validate tag matches release version
env:
TAG_VERSION: ${{ github.ref_name }}
run: |
release_version="$(node tools/release-version.cjs)"
tag_version="${TAG_VERSION#v}"
if [ "$tag_version" != "$release_version" ]; then
echo "Tag $tag_version does not match release version $release_version." >&2
exit 1
fiThen Overall the PR is clean and accomplishes its goal well. The only thing I'd flag as worth fixing is the unquoted 🧠 Learnings used✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/release.yml (1)
165-177: Consider quoting or using parameter expansion for$prerelease_flag.The unquoted
$prerelease_flagon line 177 works correctly in bash (empty variables expand to nothing), but ShellCheck flags this pattern (SC2086). For explicitness and to satisfy linters:♻️ Option 1: Use conditional parameter expansion
gh release create "$tag" \ --repo "$GITHUB_REPOSITORY" \ --target "$TARGET_SHA" \ --title "TKO ${VERSION}" \ --generate-notes \ - $prerelease_flag + ${prerelease_flag:+"$prerelease_flag"}♻️ Option 2: Build an argument array
- prerelease_flag="" + release_args=("$tag" --repo "$GITHUB_REPOSITORY" --target "$TARGET_SHA" --title "TKO ${VERSION}" --generate-notes) case "$VERSION" in *-alpha*|*-beta*|*-rc*) - prerelease_flag="--prerelease" + release_args+=(--prerelease) ;; esac - gh release create "$tag" \ - --repo "$GITHUB_REPOSITORY" \ - --target "$TARGET_SHA" \ - --title "TKO ${VERSION}" \ - --generate-notes \ - $prerelease_flag + gh release create "${release_args[@]}"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release.yml around lines 165 - 177, The unquoted variable $prerelease_flag passed into the gh release create command (after computing prerelease_flag from VERSION) should be expanded safely to avoid SC2086; change the invocation to either use conditional parameter expansion so the flag is only inserted when non-empty (e.g., ${prerelease_flag:+$prerelease_flag}) or build an argument array and append prerelease_flag only when set, then invoke gh release create with that array (refer to the prerelease_flag variable, the gh release create invocation, and the VERSION/tag/TARGET_SHA variables to locate the code to change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/release.yml:
- Around line 165-177: The unquoted variable $prerelease_flag passed into the gh
release create command (after computing prerelease_flag from VERSION) should be
expanded safely to avoid SC2086; change the invocation to either use conditional
parameter expansion so the flag is only inserted when non-empty (e.g.,
${prerelease_flag:+$prerelease_flag}) or build an argument array and append
prerelease_flag only when set, then invoke gh release create with that array
(refer to the prerelease_flag variable, the gh release create invocation, and
the VERSION/tag/TARGET_SHA variables to locate the code to change).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3d805c7b-8eb4-4460-8b7e-05aa06140a37
📒 Files selected for processing (1)
.github/workflows/release.yml
Summary
Testing
Summary by CodeRabbit