Skip to content

Fix GitVersion branch regex to match v17/main - #1058

Merged
KevinJump merged 1 commit into
v17/mainfrom
fix/gitversion-branch-regex-v17
Aug 28, 2026
Merged

Fix GitVersion branch regex to match v17/main#1058
KevinJump merged 1 commit into
v17/mainfrom
fix/gitversion-branch-regex-v17

Conversation

@KevinJump

Copy link
Copy Markdown
Owner

Summary

  • The Build and Package workflow has been failing on v17/main since it was enabled there (Run PR build/test and package workflows on v17/main #1056) with GitVersion output is not valid JSON.
  • Root cause: GitVersion.yml's main branch config regex was still ^v15\/main$, so GitVersion couldn't match v17/main, found no branch to inherit config from, and threw InvalidOperationException.
  • Fix: generalize the regex to ^v\d+\/main$ so it matches the current LTS branch and future ones without needing edits per version bump.

Test plan

  • Ran dotnet-gitversion locally against this repo/config before the fix — reproduced the crash (Gitversion could not determine which branch to treat as the development branch...).
  • Ran it again after the fix — produced a valid version (17.3.9-ci.4).
  • Confirm the "v16 - Build and Package." workflow run goes green on this PR/after merge.

The main-branch regex was still pinned to v15/main, so GitVersion
couldn't match v17/main, found no fallback branch config, and threw
(surfacing as "GitVersion output is not valid JSON" in the Build and
Package workflow). Generalize the regex to match any vNN/main branch.
@KevinJump
KevinJump merged commit 09c3853 into v17/main Aug 28, 2026
5 checks passed
@KevinJump
KevinJump deleted the fix/gitversion-branch-regex-v17 branch August 28, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant