Resolve `/backport all` and `/backport <major>` to applicable SDK branches
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Is your feature request related to a problem?
The SDK's `/backport` automation requires contributors to know and name each target branch separately. The applicable branches vary by SDK major version, support phase, available feature bands, and pre-GA preview/RC branches. This makes it easy to omit a relevant branch or request unnecessary backports.
The generic multi-target execution support is tracked separately in dotnet/arcade#17407.
### Describe the solution you'd like
Add an SDK-owned target resolver in `.github/scripts/` and update `.github/workflows/backport.yml` to support these commands:
- `/backport all`: resolve all applicable branches for active and pre-GA SDK channels.
- `/backport `: resolve all applicable branches for one active or pre-GA SDK major, such as `/backport 10`.
- `/backport to `: immediately return the explicit branch without loading release metadata or enumerating release branches, preserving the existing single-target behavior.
Automatic selection should ignore `maintenance` and `eol` channels. The explicit branch form should not be restricted by channel status.
Resolve automatic targets from official .NET release metadata and branches that actually exist in `dotnet/sdk`:
- For .NET 9 and below, select existing `1xx`, `3xx`, and `4xx` branches.
- For .NET 10 and higher, select `1xx` and the numerically highest existing feature-band branch, deduplicating when `1xx` is highest.
- Before GA, additionally select the semantically latest preview or RC branch. Include both the unsuffixed `1xx` branch and that latest preview/RC branch.
- Exclude the source PR's base branch, deduplicate targets, and reject malformed or unsupported selectors with an explanatory PR comment.
The resolver should return a JSON array to the Arcade reusable workflow. Arcade would own the generic matrix execution while SDK retains all product-specific support and branch-selection policy.
Add focused `node:test` coverage for command parsing, support-phase filtering, feature-band selection, preview/RC ordering, missing branches, deduplication, source-branch exclusion, and invalid selectors. Update the developer guide with the new command forms and selection rules.
### Alternatives you've considered
- Keep requiring one `/backport to ` comment per target. This preserves the current implementation but leaves branch-policy knowledge and omission risk with each contributor.
- Put SDK release policy directly in Arcade. This would couple a generic shared workflow to SDK-specific support phases and branch naming.
- Have the resolver post several synthetic `/backport to ...` comments. This would be noisy, recursive, and harder to authorize and report reliably than passing resolved targets directly.
### Additional context
Arcade dependency: dotnet/arcade#17407
Current SDK workflow: https://github.com/dotnet/sdk/blob/main/.github/workflows/backport.yml
Current Arcade reusable workflow: https://github.com/dotnet/arcade/blob/main/.github/workflows/backport-base.yml
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with .github/workflows/backport.yml and the SDK-owned resolver requested in .github/scripts/, then inspect the current backport flow and the Arcade reusable workflow. Run the focused node:test coverage for parsing, filtering, branch selection, ordering, deduplication, exclusions, and invalid selectors. Done means the three command forms return the correct JSON targets, comments explain rejected selectors, and the developer guide documents the rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, node.js
- Domain
- ci-cd, release, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100