Pre-releases should not ovewrite existings versions#150
Conversation
📝 WalkthroughWalkthroughThe publish workflow is modified to compute Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
|
Automated deployment preview for the PR in the Cloudflare Pages. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/publish.yaml:
- Around line 39-41: The prerelease tag generation uses a static suffix and can
be overwritten; update the echo that sets tag_name to include a unique per-run
identifier (for example append GITHUB_RUN_ID or a short GITHUB_SHA) so each
pre-release is unique; specifically change the echo that writes tag_name
(currently creating v${MAJOR}.${MINOR}.${NEXT_PATCH}-pre) to include the run id
or commit hash (e.g. v${MAJOR}.${MINOR}.${NEXT_PATCH}-pre-${GITHUB_RUN_ID} or
v${MAJOR}.${MINOR}.${NEXT_PATCH}-pre-${GITHUB_SHA::7}) so prereleases are not
clobbered.
- Around line 36-37: Replace deriving tag_name from package.json with the actual
Git tag that triggered the workflow: when checking if GITHUB_REF_TYPE equals
"tag" (the if block containing the echo), set tag_name using the GITHUB_REF_NAME
environment variable instead of v$VERSION — i.e. emit tag_name based on
$GITHUB_REF_NAME so the publish uses the exact tag that triggered the run.
| if [ "$GITHUB_REF_TYPE" = "tag" ]; then | ||
| echo "tag_name=v$VERSION" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
Use the triggering Git tag directly for tag builds.
For tag-triggered runs, deriving tag_name from package.json can mismatch the pushed tag and publish under the wrong tag/release. Use GITHUB_REF_NAME here.
Suggested fix
- if [ "$GITHUB_REF_TYPE" = "tag" ]; then
- echo "tag_name=v$VERSION" >> "$GITHUB_OUTPUT"
+ if [ "$GITHUB_REF_TYPE" = "tag" ]; then
+ echo "tag_name=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if [ "$GITHUB_REF_TYPE" = "tag" ]; then | |
| echo "tag_name=v$VERSION" >> "$GITHUB_OUTPUT" | |
| if [ "$GITHUB_REF_TYPE" = "tag" ]; then | |
| echo "tag_name=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/publish.yaml around lines 36 - 37, Replace deriving
tag_name from package.json with the actual Git tag that triggered the workflow:
when checking if GITHUB_REF_TYPE equals "tag" (the if block containing the
echo), set tag_name using the GITHUB_REF_NAME environment variable instead of
v$VERSION — i.e. emit tag_name based on $GITHUB_REF_NAME so the publish uses the
exact tag that triggered the run.
Summary by CodeRabbit