Skip to content

Infer version from tags/branches instead of Versions.props#37985

Merged
roji merged 3 commits into
dotnet:mainfrom
roji:version-detection-from-tags-branches
Mar 24, 2026
Merged

Infer version from tags/branches instead of Versions.props#37985
roji merged 3 commits into
dotnet:mainfrom
roji:version-detection-from-tags-branches

Conversation

@roji
Copy link
Copy Markdown
Member

@roji roji commented Mar 24, 2026

Replace the eng/Versions.props-based version detection in the label-and-milestone-issues workflow with logic that infers versions from tags and branches present in the repo:

  • release/X.Y (servicing): Lists vX.Y.* tags via GitHub API, finds the highest GA patch (< 100), and sets milestone to X.Y.(patch+1). No preview/rc label.
  • main: Reads only major.minor from Versions.props, then lists release/X.Y-* branches to find the highest preview/rc branch. The next version is inferred: preview7→rc-1, rc1→rc-2, rc2→GA (no label). Milestone is X.Y.0.

This fixes the issue where Versions.props was frequently updated too late and didn't represent the correct version at merge time.

Replace the eng/Versions.props-based version detection in the
label-and-milestone-issues workflow with logic that infers versions
from tags and branches present in the repo:

- release/X.Y (servicing): list vX.Y.* tags via GitHub API, find the
  highest GA patch (< 100), set milestone to X.Y.(patch+1). No
  preview/rc label.
- main: read only major.minor from Versions.props, then list
  release/X.Y-* branches to find the highest preview/rc branch. The
  next version is inferred: preview7→rc-1, rc1→rc-2, rc2→GA (no
  label). Milestone is X.Y.0.

This fixes the issue where Versions.props was frequently updated too
late and didn't represent the correct version at merge time.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roji roji requested a review from a team as a code owner March 24, 2026 15:58
Copilot AI review requested due to automatic review settings March 24, 2026 15:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the issue labeling/milestoning automation to derive the version context from repository tags and branch names (rather than relying on eng/Versions.props at merge time), aiming to make version selection accurate even when Versions.props lags behind.

Changes:

  • Replaces Versions.props-based pre-release detection with logic that infers the target milestone/label from the PR’s base branch plus matching tags/branches.
  • For release/X.Y, computes the next patch milestone from the highest vX.Y.* GA tag.
  • For main, reads only major.minor from Versions.props and infers the next preview/RC label from existing release/X.Y-* branches.

Comment thread .github/workflows/label-and-milestone-issues.yml
Comment thread .github/workflows/label-and-milestone-issues.yml Outdated
Comment thread .github/workflows/label-and-milestone-issues.yml Outdated
@roji roji enabled auto-merge (squash) March 24, 2026 16:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 16:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/label-and-milestone-issues.yml Outdated
Comment thread .github/workflows/label-and-milestone-issues.yml Outdated
Comment thread .github/workflows/label-and-milestone-issues.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 16:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/label-and-milestone-issues.yml
}
}
}

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If no GA tags are found for the servicing branch (i.e., highestPatch stays -1), the computed milestone becomes X.Y.0, which is likely incorrect and may silently create the wrong milestone. It would be safer to fail fast (or handle the bootstrap case explicitly) when no matching vX.Y.Z tags are present, rather than defaulting to .0.

Suggested change
if (highestPatch === -1) {
throw new Error(`No GA v${major}.${minor}.Z tags found for servicing branch ${targetBranch}`);
}

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/label-and-milestone-issues.yml
@roji roji merged commit f8d2760 into dotnet:main Mar 24, 2026
14 checks passed
@roji roji deleted the version-detection-from-tags-branches branch March 24, 2026 17:39
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.

3 participants