Skip to content

Automate setting closed issue milestones#37872

Open
roji wants to merge 1 commit intodotnet:mainfrom
roji:ChangeMilestone
Open

Automate setting closed issue milestones#37872
roji wants to merge 1 commit intodotnet:mainfrom
roji:ChangeMilestone

Conversation

@roji
Copy link
Member

@roji roji commented Mar 6, 2026

Continues the previous work for applying preview version labels: this now also sets the closed issue's milestone, for both vnext on main (e.g. 11.0.0) and for release (servicing) PRs.

@roji roji requested a review from a team as a code owner March 6, 2026 13:26
Copilot AI review requested due to automatic review settings March 6, 2026 13:26
Copy link

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 existing GitHub Actions automation which labels issues closed by merged PRs, extending it to also move those closed issues from the Backlog milestone (or no milestone) to the milestone for the current major version derived from eng/Versions.props.

Changes:

  • Read VersionPrefix from eng/Versions.props on the PR target branch to determine the major-version milestone (e.g. 11.0.0).
  • Query closing issues via GraphQL including their milestone, and update milestones when needed.
  • Improve logging and aggregate per-issue failures into a single workflow failure.
Comments suppressed due to low confidence (3)

.github/workflows/label-and-milestone-issues.yml:118

  • The workflow now throws when no matching preview/RC release/* branches are found (or when the latest major has no preview/RC branches). Since this job runs on every merged PR to main, this change can turn a previously benign 'skip' case into a failing workflow run, creating noisy failures during periods without preview/RC branches. Consider logging and returning (skip) instead of throwing here, unless a failing workflow run is explicitly desired.
    .github/workflows/label-and-milestone-issues.yml:168
  • listMilestones is called with state: 'open' and only the first page (per_page: 100) is fetched. This can cause the workflow to fail for servicing branches where the ${majorVersion}.0.0 milestone may already be closed (or if there are >100 milestones), even though GitHub still allows assigning a closed milestone to issues. Consider listing milestones with state: 'all' and paginating (or using github.paginate) before searching by title.
    .github/workflows/label-and-milestone-issues.yml:50
  • parseInt(versionPrefixMatch[1]) should pass a radix (e.g. 10) for consistent parsing and to avoid edge cases if the string ever includes a leading zero or other prefix.

You can also share your feedback on Copilot code review. Take the survey.

@roji roji force-pushed the ChangeMilestone branch from b375a49 to cc26d1c Compare March 6, 2026 15:44
@roji roji enabled auto-merge (squash) March 6, 2026 15:45
Comment on lines +150 to +170
// Look up the target milestone number (e.g. "11.0.0") if any issue needs a milestone update
const targetMilestoneName = `${majorVersion}.0.0`;
let targetMilestoneNumber = null;
const needsMilestoneUpdate = closingIssues.some(
issue => !issue.milestone || issue.milestone.title === 'Backlog'
);

if (needsMilestoneUpdate) {
const { data: milestones } = await github.rest.issues.listMilestones({
owner,
repo,
state: 'open',
per_page: 100
});
const targetMilestone = milestones.find(m => m.title === targetMilestoneName);
if (targetMilestone) {
targetMilestoneNumber = targetMilestone.number;
} else {
throw new Error(`Milestone '${targetMilestoneName}' not found`);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Move this below labeling

@AndriySvyryd AndriySvyryd disabled auto-merge March 6, 2026 19:19
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