-
Notifications
You must be signed in to change notification settings - Fork 227
Update GitVersion.yml with improved regex patterns for feature and hotfix branches #2161
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
…tfix branches Co-authored-by: johlju <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2161 +/- ##
====================================
Coverage 94% 94%
====================================
Files 131 131
Lines 8701 8701
====================================
Hits 8245 8245
Misses 456 456
🚀 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.
Pull Request Overview
This PR updates the GitVersion.yml configuration to improve branch pattern matching by adding a regex anchor to the feature branch pattern. The change ensures feature branches are identified more precisely by requiring the pattern to match at the beginning of the branch name.
- Updated feature branch regex to use
^anchor for precise pattern matching at the start of branch names - Added corresponding changelog entry documenting the GitVersion configuration improvement
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| GitVersion.yml | Updated feature branch regex pattern with ^ anchor for precise matching |
| CHANGELOG.md | Added changelog entry documenting the GitVersion configuration update |
WalkthroughWorkflows in GitHub Actions and Azure Pipelines were updated to stop invoking dotnet-gitversion during installation and to parse its output via ConvertFrom-Json where executed. GitVersion feature-branch regex was anchored at start. CHANGELOG updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Runner as CI Runner
participant Tools as GitVersion.Tool
participant PS as PowerShell
Runner->>Tools: Install GitVersion.Tool
note right of Tools: Install only (no execution)
Runner->>PS: Run dotnet-gitversion | ConvertFrom-Json
PS->>PS: Parse JSON to object
PS-->>Runner: Expose variables (e.g., FullSemVer)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests
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 review |
✅ Actions performedReview triggered.
|
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: 0
🧹 Nitpick comments (3)
CHANGELOG.md (1)
91-93: Entry looks good; optionally reference a tracking issue/PR.If there’s an associated issue, consider appending a link like issue #NNNN to align with the changelog guidelines. Not required if no issue exists.
GitVersion.yml (2)
20-23: Anchor hotfix regex for consistency and to avoid mid-string matches.Without start anchoring, branches like release/1.2-fix-readme could match unintentionally. Recommend anchoring to the start as done for feature.
Apply this diff:
- regex: (hot)?fix(es)?[\/-] + regex: ^(hot)?fix(es)?[\/-]
17-17: Optional: make the feature regex case-insensitive.If you want Feature/, FEATURES/, etc. to match, add an inline flag and quote the pattern to avoid YAML parsing issues.
Apply this diff:
- regex: ^f(eature(s)?)?[\/-] + regex: '(?i)^f(eature(s)?)?[\/-]'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/code-analysis-built-module.yml(0 hunks).github/workflows/code-analysis.yml(0 hunks).github/workflows/copilot-setup-steps.yml(0 hunks)CHANGELOG.md(1 hunks)GitVersion.yml(1 hunks)azure-pipelines.yml(0 hunks)
💤 Files with no reviewable changes (4)
- azure-pipelines.yml
- .github/workflows/copilot-setup-steps.yml
- .github/workflows/code-analysis-built-module.yml
- .github/workflows/code-analysis.yml
🧰 Additional context used
📓 Path-based instructions (3)
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow
- Run in PowerShell, from repository root
- Build before running tests:
.\build.ps1 -Tasks build- Always run tests in new PowerShell session:
Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow guidelines over existing code patterns
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
CHANGELOG.mdGitVersion.yml
**/*.md
⚙️ CodeRabbit configuration file
**/*.md: # Markdown Style Guidelines
- Wrap lines at word boundaries when over 80 characters (except tables/code blocks)
- Use 2 spaces for indentation
- Use '1.' for all items in ordered lists (1/1/1 numbering style)
- Disable
MD013rule by adding a comment for tables/code blocks exceeding 80 characters- Empty lines required before/after code blocks and headings (except before line 1)
- Escape backslashes in file paths only (not in code blocks)
- Code blocks must specify language identifiers
Text Formatting
- Parameters: bold
- Values/literals:
inline code- Resource/module/product names: italic
- Commands/files/paths:
inline code
Files:
CHANGELOG.md
CHANGELOG.md
⚙️ CodeRabbit configuration file
CHANGELOG.md: # Changelog Guidelines
- Always update the Unreleased section in CHANGELOG.md
- Use Keep a Changelog format
- Describe notable changes briefly, ≤2 items per change type
- Reference issues using format issue #<issue_number>
- No empty lines between list items in same section
- Do not add item if there are already an existing item for the same change
Files:
CHANGELOG.md
⏰ 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: dsccommunity.SqlServerDsc (Build Package Module)
- GitHub Check: PSScriptAnalyzer
🔇 Additional comments (2)
GitVersion.yml (2)
17-17: Anchoring the feature-branch regex is correct.This will eliminate mid-string false positives like bug/feature-... or chore/f-... LGTM.
9-18: Confirm source-branches usage.Using the configuration name 'master' while the regex targets '^main$' is valid in GitVersion (keys are config names, regex maps to actual branch names). Please confirm this is intentional for both feature and hotfix sections; if not, switch to 'main' consistently.
This PR updates the GitVersion.yml configuration to use more precise regular expressions for feature and hotfix branch pattern matching.
Changes Made
Feature Branch Regex Update
f(eature(s)?)?[\/-]^f(eature(s)?)?[\/-]The addition of the
^anchor ensures that the pattern matches only at the beginning of the branch name, providing more precise branch name matching and avoiding false positives where "feature" might appear elsewhere in the branch name.Hotfix Branch Regex
(hot)?fix(es)?[\/-]The hotfix regex was already correctly configured and matches the required pattern.
Background
The GitVersion configuration controls how version numbers are incremented based on branch naming patterns. These regex updates ensure that:
feature/,features/,f/) are correctly identified for minor version bumpshotfix/,hotfixes/,fix/,fixes/) are correctly identified for patch version bumpsThis change aligns with the project's versioning strategy and improves the reliability of automated version bumping in the CI/CD pipeline.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
This change is