Fix normalization of GitHub Actions historical tag builds - #5198
Conversation
e5d9a09 to
9032f04
Compare
|
There was a problem hiding this comment.
🟡 Changes recommended
The new GitPreparer tag-match condition can throw when the selected tag does not peel to a commit (e.g., tree/blob tags), which would reintroduce normalization crashes for some tag builds.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The new tag-match path can throw for build-selected tags that do not peel to a commit (e.g., tree/blob tags), which would abort normalization instead of falling back to existing handling.
Review details
Suppressed comments (1)
src/GitVersion.Core/Core/GitPreparer.cs:269
ITag.Committhrows when the tag does not peel to a commit (e.g., tree/blob tags). If the build-selected tag (currentTag) ever points at a non-commit object, the?.Commit.Shaaccess will raiseArgumentNullExceptionand abort normalization instead of falling back to the existing fake-branch / PR-discovery path.
var currentTag = this.buildAgent.GetCurrentTag();
if (currentBranchName.IsNullOrEmpty() && currentTag != null
&& this.repository.Tags.FirstOrDefault(tag => tag.Name.Canonical == currentTag)?.Commit.Sha == headSha)
{
- Files reviewed: 7/7 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
@asbjornu mind to check this one? it's a fix for a bug you opened |



Description
Fix GitHub Actions builds of historical release tags attempting remote PR-reference discovery during normalization. The build agent now reports the explicitly selected tag separately from branch context. When no local branch identifies HEAD, normalization resolves only that tag and preserves the detached checkout if its commit matches HEAD.
Related Issue
Resolves #4212
Motivation and Context
A tag build can have no branch tip at its commit. Previously this triggered remote-reference discovery even with fetching disabled, causing authentication failures. The selected tag supplies the necessary local information while preserving branch selection and PR discovery for missing or mismatched tag context. Unrelated tags are not dereferenced.
How Has This Been Tested?
1.2.3on both backends with normalization enabled.CI passed on the final commit, including both Git backends on Windows, Linux, and macOS. All seven GitHub workflows passed, and Sonar reports a passing quality gate with zero open issues.
Checklist