feat: Smart version bumps based on PR labels - #6
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements smart version bumping functionality that automatically determines the semantic version bump type (major, minor, or patch) based on PR labels. The workflow now checks for specific labels on merged PRs and applies the appropriate version increment.
Key changes:
- Added label-based logic to determine version bump type with fallback to patch
- Implemented version existence check to prevent duplicate publishing to crates.io
- Enhanced release notes to display the version bump type and publication status
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| - name: Check if version exists on crates.io | ||
| id: check_version | ||
| run: | | ||
| if cargo search gonfig --limit 1 | grep -q "gonfig = \"${{ env.new_version }}\""; then |
There was a problem hiding this comment.
The version check logic is flawed. The cargo search command returns results in the format gonfig = \"latest_version\" but this checks for an exact match with the new version. If the new version is newer than what's published, this grep will fail even when the version doesn't exist on crates.io.
| if cargo search gonfig --limit 1 | grep -q "gonfig = \"${{ env.new_version }}\""; then | |
| if curl -s "https://crates.io/api/v1/crates/gonfig" | jq -e '.versions[].num == "${{ env.new_version }}"' > /dev/null; then |
|
|
||
| **PR Title:** ${{ github.event.pull_request.title }} | ||
|
|
||
| **Version Bump:** ${{ steps.version_type.outputs.bump_type | upper }} |
There was a problem hiding this comment.
The upper filter is not a valid GitHub Actions expression filter. This will cause a workflow syntax error. Use {{ steps.version_type.outputs.bump_type }} and handle case conversion in the shell script if needed.
| **Version Bump:** ${{ steps.version_type.outputs.bump_type | upper }} | |
| **Version Bump:** ${{ steps.version_type.outputs.bump_type }} |
Code Review for PR #6: Smart version bumps based on PR labels🎯 Overall AssessmentThis PR introduces an intelligent version bumping mechanism based on PR labels, which is a solid improvement to the CI/CD pipeline. The implementation enhances the semantic versioning workflow and adds important safeguards. ✅ Strengths
|
Summary
Enhanced the version-bump workflow to intelligently determine version bump type based on PR labels.
Changes
majorlabel → major version bumpminorlabel → minor version bumpmajorandminorlabels to repositoryHow it works
Testing
This enables proper semantic versioning based on the nature of changes in each PR.