Repository navigation
Use PreReleaseVersionLabel to detect servicing branches in CodeCheck.ps1 - #68051
Merged
Merged
Conversation
Previously, CodeCheck.ps1 used a branch-name heuristic (`release*` and not `*preview*`/`*rc1*`/`*rc2*`) to decide whether PublicAPI.Unshipped.txt changes should be flagged as an error. A branch like "release/11.0" is created well before it reaches rtm/servicing status, so this heuristic produced false positives for any pre-release stage it didn't explicitly enumerate (e.g. rc3+). Replace it with a check against the target branch's actual PreReleaseVersionLabel (read from its eng/Versions.props via git show), only flagging Unshipped.txt changes once the label is 'rtm' or 'servicing'. Fails closed if the ref/property can't be read or the label is unrecognized. Fixes dotnet#50635 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the API baseline checks in eng/scripts/CodeCheck.ps1 to determine whether PublicAPI.Unshipped.txt changes should be treated as errors based on the target branch’s PreReleaseVersionLabel from eng/Versions.props, rather than relying on branch-name heuristics that misclassify late RC stages.
Changes:
- Reads
origin/<targetBranch>:eng/Versions.propsand parsesPreReleaseVersionLabel, validating it against expected labels. - Treats
PublicAPI.Unshipped.txtedits as errors only when the label isrtmorservicing. - Removes the previous
release*/preview/rc1/rc2branch-name-based detection logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #50635
CodeCheck.ps1tried to excluderc1/rc2branches from thePublicAPI.Unshipped.txtcheck by testing whether$targetBranch(e.g.release/11.0) containedrc1/rc2as a substring. But that information lives inPreReleaseVersionLabel, not the branch name, so the check never matched —release/11.0was incorrectly flagged as a servicing branch throughout its entirerc1/rc2lifetime, well before it actually reachedrtm/servicing.Fix: read the target branch's actual
PreReleaseVersionLabelfrom itseng/Versions.props(viagit show origin/$targetBranch:eng/Versions.props) and only flagUnshipped.txtchanges once the label isrtmorservicing— the same source of truth used elsewhere (e.g.IsServicingBuild). Fails closed if the ref/file can't be read or the label is missing/unrecognized.Validated with PowerShell 7 against real refs (
origin/main→alpha,origin/release/8.0→servicing) and simulated failure cases.🤖 Generated with Copilot CLI