Skip to content

Commit 643b230

Browse files
CopilotPureWeen
andcommitted
Use dynamically queried milestones instead of hardcoded SR3, SR4, Servicing values
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
1 parent 50ff7ca commit 643b230

File tree

2 files changed

+102
-23
lines changed

2 files changed

+102
-23
lines changed

.github/skills/issue-triage/SKILL.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ What would you like to do with this issue?
7575
### Step 4: Wait for User Decision
7676

7777
Wait for user to say:
78-
- A milestone name (e.g., "Backlog", "SR3", ".NET 10 Servicing")
78+
- A milestone name (e.g., "Backlog", "current SR", "Servicing")
7979
- "yes" to accept suggestion
8080
- "skip" or "next" to move on without changes
81-
- Specific instructions (e.g., "SR4 and add regression label")
81+
- Specific instructions (e.g., "next SR and add regression label")
8282

8383
### Step 5: Apply Changes and Move to Next
8484

@@ -100,36 +100,41 @@ After applying changes, automatically present the NEXT issue.
100100

101101
## Milestone Suggestion Logic
102102

103+
The script dynamically queries current milestones from dotnet/maui and suggests them based on issue characteristics:
104+
103105
| Condition | Suggested Milestone | Reason |
104106
|-----------|---------------------|--------|
105107
| Linked PR has milestone | PR's milestone | "PR already has milestone" |
106-
| Has `i/regression` + regressed in .NET 10 | .NET 10.0 SR3 | "Regression in .NET 10" |
107-
| Has `i/regression` (other) | .NET 10.0 SR4 | "Regression" |
108-
| Has open linked PR | .NET 10 Servicing | "Has open PR" |
108+
| Has `i/regression` label | Current SR milestone (soonest due) | "Regression - current SR milestone" |
109+
| Has open linked PR | Servicing milestone (or next SR) | "Has open PR" |
109110
| Default | Backlog | "No PR, not a regression" |
110111

112+
**Note**: SR milestones are sorted by due date, so the soonest SR is suggested for regressions. Milestone names change monthly, so they are queried dynamically rather than hardcoded.
113+
111114
## Applying Triage Decisions
112115

113116
```bash
114117
# Set milestone only
115118
gh issue edit ISSUE_NUMBER --repo dotnet/maui --milestone "Backlog"
116119

117120
# Set milestone and add labels
118-
gh issue edit ISSUE_NUMBER --repo dotnet/maui --milestone ".NET 10.0 SR3" --add-label "i/regression"
121+
gh issue edit ISSUE_NUMBER --repo dotnet/maui --milestone "MILESTONE_NAME" --add-label "i/regression"
119122

120123
# Set milestone on both issue AND linked PR
121-
gh issue edit ISSUE_NUMBER --repo dotnet/maui --milestone ".NET 10.0 SR3"
122-
gh pr edit PR_NUMBER --repo dotnet/maui --milestone ".NET 10.0 SR3"
124+
gh issue edit ISSUE_NUMBER --repo dotnet/maui --milestone "MILESTONE_NAME"
125+
gh pr edit PR_NUMBER --repo dotnet/maui --milestone "MILESTONE_NAME"
123126
```
124127

125-
## Common Milestone Choices
128+
## Common Milestone Types
129+
130+
| Milestone Type | Use When |
131+
|----------------|----------|
132+
| Current SR (e.g., SR3) | Regressions, critical bugs with PRs ready |
133+
| Next SR (e.g., SR4) | Important bugs, regressions being investigated |
134+
| Servicing | General fixes with PRs, non-urgent improvements |
135+
| Backlog | No PR, not a regression, nice-to-have fixes |
126136

127-
| Milestone | Use When |
128-
|-----------|----------|
129-
| `.NET 10.0 SR3` | Regressions in .NET 10, critical bugs with PRs ready |
130-
| `.NET 10.0 SR4` | Important bugs, regressions being investigated |
131-
| `.NET 10 Servicing` | General fixes with PRs, non-urgent improvements |
132-
| `Backlog` | No PR, not a regression, nice-to-have fixes |
137+
**Note**: Use `init-triage-session.ps1` to see current milestone names.
133138

134139
## Label Quick Reference
135140

.github/skills/issue-triage/scripts/query-issues.ps1

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,73 @@ $platformLabels = @{
118118
"maccatalyst" = "platform/macOS 🍏"
119119
}
120120

121+
# Query current milestones dynamically to avoid hardcoding
122+
Write-Host "Fetching current milestones..." -ForegroundColor DarkGray
123+
$currentMilestones = @{
124+
CurrentSR = "" # The soonest SR milestone (for regressions)
125+
NextSR = "" # The next SR milestone (for other important bugs)
126+
Servicing = "" # The Servicing milestone (for PRs)
127+
Backlog = "Backlog" # Always "Backlog"
128+
}
129+
130+
try {
131+
$msResult = gh api repos/dotnet/maui/milestones --jq '.[] | {title, due_on}' 2>$null
132+
$msLines = $msResult -split "`n" | Where-Object { $_.Trim() -ne "" }
133+
134+
$srMilestones = @()
135+
$servicingMilestone = ""
136+
137+
foreach ($line in $msLines) {
138+
try {
139+
$ms = $line | ConvertFrom-Json -ErrorAction Stop
140+
# Match .NET SR milestones (e.g., ".NET 10.0 SR3", ".NET 9.0 SR5")
141+
if ($ms.title -match "\.NET.*SR\d+") {
142+
$srMilestones += [PSCustomObject]@{
143+
Title = $ms.title
144+
DueOn = $ms.due_on
145+
}
146+
}
147+
# Match Servicing milestones (e.g., ".NET 10 Servicing")
148+
elseif ($ms.title -match "\.NET.*Servicing" -and $ms.title -notmatch "SR") {
149+
$servicingMilestone = $ms.title
150+
}
151+
}
152+
catch {
153+
# Skip lines that aren't valid JSON
154+
continue
155+
}
156+
}
157+
158+
# Sort SR milestones by due date (soonest first) or by SR number
159+
if ($srMilestones.Count -gt 0) {
160+
$sortedSR = $srMilestones | Sort-Object {
161+
$parsedDate = [DateTime]::MinValue
162+
if ($_.DueOn -and [DateTime]::TryParse($_.DueOn, [ref]$parsedDate)) {
163+
$parsedDate
164+
} else {
165+
[DateTime]::MaxValue
166+
}
167+
}
168+
$currentMilestones.CurrentSR = $sortedSR[0].Title
169+
if ($sortedSR.Count -gt 1) {
170+
$currentMilestones.NextSR = $sortedSR[1].Title
171+
} else {
172+
$currentMilestones.NextSR = $sortedSR[0].Title
173+
}
174+
}
175+
176+
if ($servicingMilestone) {
177+
$currentMilestones.Servicing = $servicingMilestone
178+
}
179+
180+
Write-Host " Current SR: $($currentMilestones.CurrentSR)" -ForegroundColor DarkGray
181+
Write-Host " Next SR: $($currentMilestones.NextSR)" -ForegroundColor DarkGray
182+
Write-Host " Servicing: $($currentMilestones.Servicing)" -ForegroundColor DarkGray
183+
}
184+
catch {
185+
Write-Host " Warning: Could not fetch milestones, using defaults" -ForegroundColor Yellow
186+
}
187+
121188
# Build gh issue list command arguments
122189
$ghArgs = @(
123190
"issue", "list",
@@ -323,7 +390,7 @@ foreach ($issue in $issues) {
323390
}
324391

325392
# Generate milestone suggestion based on issue characteristics
326-
$suggestedMilestone = "Backlog"
393+
$suggestedMilestone = $currentMilestones.Backlog
327394
$suggestionReason = "No PR, not a regression"
328395

329396
# Check if any linked PR has a milestone
@@ -340,19 +407,26 @@ foreach ($issue in $issues) {
340407
$suggestionReason = "PR already has milestone"
341408
}
342409
elseif ($isRegression) {
343-
if ($regressedIn -match "10\.0\.0|10-preview|10-rc") {
344-
$suggestedMilestone = ".NET 10.0 SR3"
345-
$suggestionReason = "Regression in .NET 10"
410+
# Use the current (soonest) SR milestone for regressions
411+
if ($currentMilestones.CurrentSR) {
412+
$suggestedMilestone = $currentMilestones.CurrentSR
413+
$suggestionReason = "Regression - current SR milestone"
346414
} else {
347-
$suggestedMilestone = ".NET 10.0 SR4"
348-
$suggestionReason = "Regression"
415+
$suggestedMilestone = $currentMilestones.Backlog
416+
$suggestionReason = "Regression (no SR milestone found)"
349417
}
350418
}
351419
elseif ($linkedPRs.Count -gt 0) {
352420
$openPRs = $linkedPRs | Where-Object { $_.State -eq "OPEN" }
353421
if ($openPRs.Count -gt 0) {
354-
$suggestedMilestone = ".NET 10 Servicing"
355-
$suggestionReason = "Has open PR"
422+
# Use Servicing milestone for PRs, fallback to next SR
423+
if ($currentMilestones.Servicing) {
424+
$suggestedMilestone = $currentMilestones.Servicing
425+
$suggestionReason = "Has open PR"
426+
} elseif ($currentMilestones.NextSR) {
427+
$suggestedMilestone = $currentMilestones.NextSR
428+
$suggestionReason = "Has open PR"
429+
}
356430
}
357431
}
358432

0 commit comments

Comments
 (0)