-
Notifications
You must be signed in to change notification settings - Fork 101
Add version bump workflow #2109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant GHA as GitHub Actions
participant Git as Git/GitHub
participant File as package.json
participant API as GitHub API
User->>GHA: Trigger workflow_dispatch (new_version)
activate GHA
GHA->>GHA: Set NEW_VERSION, NEW_BRANCH, GH_TOKEN
GHA->>Git: Checkout main
Git-->>GHA: main checked out
GHA->>File: Run npm version (no-tag) -> update version
File-->>GHA: version updated
GHA->>Git: Create branch and commit changes (EndBug/add-and-commit)
Git-->>GHA: branch pushed
GHA->>API: Create PR to main with title/body and skip-changelog label
API-->>GHA: PR created
deactivate GHA
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✏️ Tip: You can disable this entire section by setting 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2109 +/- ##
==========================================
+ Coverage 97.54% 97.60% +0.05%
==========================================
Files 15 17 +2
Lines 611 625 +14
Branches 101 100 -1
==========================================
+ Hits 596 610 +14
Misses 14 14
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/workflows/bump-package-version.yml (2)
32-41: Consider handling duplicate PR scenario.If the workflow is triggered multiple times with the same version, it will fail when attempting to create a PR from a branch that already has an open PR. Consider adding error handling or checking for existing PRs first.
🔎 Optional: Add duplicate PR check
- name: Create the PR pointing to main run: | + # Check if PR already exists + if gh pr list --head "$NEW_BRANCH" --state open --json number --jq '.[0].number' | grep -q .; then + echo "PR already exists for branch $NEW_BRANCH" + exit 0 + fi gh pr create \ --title "Update version for the next release (v$NEW_VERSION)" \ --body '_This PR is auto-generated._ The automated script updates the version of meilisearch-js to a new version: "v$NEW_VERSION"' \ --label 'skip-changelog' \ --base main \ --head ${{ env.NEW_BRANCH }}
23-25: Consider usingnpm versionfor consistency with npm best practices.The repository doesn't currently have
package-lock.jsonoryarn.lock, so the sed approach works for the current setup. However,npm versionis the standard approach for version bumping and would be more maintainable if lock files are added in the future:🔎 Proposed refactor using npm version
- - name: Update package.json file + - name: Update package version run: | - sed -i -E 's/("version":[[:space:]]*")([^"]+)(")/\1'"$NEW_VERSION"'\3/' package.json + npm version "$NEW_VERSION" --no-git-tag-versionThis uses npm's built-in version management, which automatically handles both
package.jsonand lock files if they're added later.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/bump-package-version.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: integration-tests (Node.js 20)
- GitHub Check: integration-tests (Node.js 22)
🔇 Additional comments (2)
.github/workflows/bump-package-version.yml (2)
10-13: LGTM!Environment variable setup is appropriate. Using a PAT for
GH_TOKENis necessary for the workflow to create PRs, and the branch naming convention is clear.
19-22: LGTM!Checkout configuration correctly targets the main branch.
flevi29
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this, so you may experiment with it.
One note I'd add is that it would probably be better to use npm version if possible.
This will supersede my attempt at a similar PR #1869.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/bump-package-version.yml:
- Around line 23-25: The workflow step that runs "pnpm version ${{
env.NEW_VERSION }} --no-git-tag-version" will fail because pnpm isn't guaranteed
to be available on GitHub runners; add a step before the "Update package.json
file" step to install/setup pnpm (for example use the pnpm/action-setup@v2
action or run a Corepack enable/install command) so the pnpm binary is present,
or alternatively remove the explicit pnpm invocation and let the action
auto-detect the package manager if your package.json has a packageManager field.
♻️ Duplicate comments (2)
.github/workflows/bump-package-version.yml (2)
3-8: Input validation for version format is still missing.The
new_versioninput accepts any string without validation. Invalid versions could break the package manifest. The previous review comment suggesting a validation step is still applicable.
26-31: Consider including lock file in commit.The previous review comment about including lock files is still relevant. With pnpm, if
pnpm-lock.yamlis updated, it should be committed as well.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/bump-package-version.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: integration-tests (Node.js 20)
- GitHub Check: integration-tests (Node.js 22)
🔇 Additional comments (3)
.github/workflows/bump-package-version.yml (3)
10-13: LGTM!Environment variables are well-defined with a clear branch naming convention.
32-41: LGTM!The PR creation step is well-structured with a descriptive title, body, and appropriate labeling. Using
gh pr createwith the bot PAT token ensures proper authentication.
19-22: No issues found.actions/checkout@v6is the current latest stable version as of January 2026.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
Thanks for the recommendation @flevi29 |
Pull Request
why
how
bump-package-version.ymlworkflow that can be manually triggeredPR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.