Skip to content

Conversation

@shenxianpeng
Copy link
Collaborator

@shenxianpeng shenxianpeng commented Aug 17, 2025

Right now, if we published a pre-release, the tag v2 will also be updated to point to the pre-release. which is not what we wanted.

We should change the type to released

Summary by CodeRabbit

  • Chores
    • Updated release automation to run only on finalized releases, ensuring artifacts and notifications are generated at the correct stage. This improves consistency and reduces premature triggers during the release process. No changes to product features or UI, but users may notice more predictable release timing and availability across distribution channels. No action required from users.

@shenxianpeng shenxianpeng requested a review from a team as a code owner August 17, 2025 18:43
@shenxianpeng shenxianpeng requested review from 2bndy5 and Copilot and removed request for a team August 17, 2025 18:43
@github-actions github-actions bot added the bug Something isn't working label Aug 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the GitHub Actions workflow trigger to prevent updating the v2 tag when a pre-release is published. The change ensures that only actual releases (not pre-releases) trigger the tag update workflow.

  • Changes the release event type from published to released in the workflow trigger

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 17, 2025

Walkthrough

Updated the GitHub Actions release workflow to trigger on the release event type "released" instead of "published." No other workflow configuration or steps were changed.

Changes

Cohort / File(s) Summary
CI Workflow Triggers
.github/workflows/release.yml
Changed on: release trigger from types: [published] to types: [released]; all other workflow steps remain unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-release-type

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
.github/workflows/release.yml (5)

5-5: branches filter is not supported for release events

The release event doesn’t support branch filters; this key is ignored. Consider removing it for correctness and to avoid confusion.

Apply this diff:

-    branches: [main]

23-26: Make checkout ref robust across triggers (release vs. workflow_dispatch)

ref: ${{ inputs.ref }} will be empty for release-triggered runs. While actions/checkout may fall back, it’s safer and clearer to explicitly select the release tag when present, or the workflow input when manually dispatched.

Apply this diff:

       with:
         fetch-depth: 0
-        ref: ${{ inputs.ref }}
+        # Prefer the manual input when provided, otherwise use the release tag (or default ref)
+        ref: ${{ inputs.ref || github.event.release.tag_name || github.ref }}

31-39: Harden conditions for manual vs. release runs

Relying on github.event.inputs.tag being '' for non-dispatch events is brittle. Make the event explicit to avoid surprises and improve readability.

Apply this diff:

-      if: github.event.inputs.tag != ''
+      # Run only for manual dispatch when a tag is provided
+      if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
@@
-      if: github.event.inputs.tag == ''
+      # Run for release events or for manual dispatch when no tag is provided
+      if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.tag == '')

19-21: Ensure token permissions allow pushing tags

If the repository’s default workflow permissions are read-only, pushing/deleting tags will fail. Grant contents: write at the job level.

Apply this diff:

   re-tag:
+    permissions:
+      contents: write
     runs-on: ubuntu-latest

30-43: Optional: simplify re-tagging with force-push instead of delete+recreate

Deleting then pushing introduces a brief gap where the tag doesn’t exist. A force update is simpler and atomic.

Here’s an example for the v2 step (apply similarly to the parameterized step):

-        git tag --delete v2 || true
-        git push --delete origin v2 || true
-        git tag -a v2 -m 'Retag v2'
-        git push origin v2
+        git tag -fa v2 -m 'Retag v2'
+        git push --force-with-lease origin refs/tags/v2
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d7155ea and 9153c2a.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/release.yml (2)

6-6: Correct event type: switching to released avoids pre-release runs

Using types: [released] ensures the workflow won’t run for pre-releases. This aligns with the PR objective. Looks good.


22-22: Confirmed actions/checkout@v5 is correct

  • Verified that actions/checkout@v5 exists and is the current stable major version as of August 2025.
  • No changes needed.

@2bndy5
Copy link
Collaborator

2bndy5 commented Aug 17, 2025

We could also use tags (a list of glob patterns -- see docs' example patterns) to match certain tags. But this might be more complex than desired.

I don't actually use release-drafter for any other projects. Instead I use a CI workflow_dispatch trigger to run a nushell script that updates anything about releasing new tags: README examples, CHANGELOG regeneration, etc. See example in another GH action that I recently published with this approach. The bump-n-release.nu script is used to automate updates to CHANGELOG and moves certain applicable tags (vX and vX.Y).

@shenxianpeng
Copy link
Collaborator Author

tags is a good point for this problem. changing the event type might be an easier way to avoid updating tags for a pre-release.

That’s right—release-drafter is limited to updating files like README, CHANGELOG, etc. It’s still a good and simple way to automate releases, and I’d prefer not to change it unless it truly stops working well for us.

@shenxianpeng shenxianpeng merged commit 538ab6c into main Aug 18, 2025
6 checks passed
@shenxianpeng shenxianpeng deleted the fix-release-type branch August 18, 2025 09:57
@2bndy5
Copy link
Collaborator

2bndy5 commented Aug 27, 2025

Any reason to not publish v2.16.1? I See the draft has to be altered about the version number. Also the pre-release flag can be removed from v2.16.0 release if we are going to publish v2.16.1.

@shenxianpeng
Copy link
Collaborator Author

shenxianpeng commented Aug 27, 2025

I forgot we have a draft release. The easiest way is to delete the draft, so I did it. And the new release is v2.16.0

@2bndy5
Copy link
Collaborator

2bndy5 commented Aug 27, 2025

I forgot we have a draft release. The easiest way is to delete the draft, so I did it. And the new release is v2.16.0

I think there are some changes missing from the newly generated release notes.

@2bndy5
Copy link
Collaborator

2bndy5 commented Aug 27, 2025

In the future, it is probably better to just delete the tag if we want to "yank" a release.

@shenxianpeng
Copy link
Collaborator Author

I forgot we have a draft release. The easiest way is to delete the draft, so I did it. And the new release is v2.16.0

I think there are some changes missing from the newly generated release notes.

Yes. It is. I missed switching uv change note

@shenxianpeng
Copy link
Collaborator Author

In the future, it is probably better to just delete the tag if we want to "yank" a release.

Good point

@shenxianpeng
Copy link
Collaborator Author

I am continuing to make mistakes 😵‍💫 I'll need a little time later to get everything organized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants