Milestone Filter
Filter rules based on PR milestone
The Milestone Filter allows you to apply rules only to pull requests that have (or don’t have) specific milestones. This helps target rules based on release planning or project phases.
Configuration
Must be set to "milestone"
Whether a milestone is required for the rule to apply
Milestone title pattern(s) that should match (supports regex)
Milestone title pattern(s) that should not match (supports regex)
Basic Usage
Examples
Match Specific Milestone
Apply a rule only to PRs with a specific milestone:
Match Multiple Milestones
Apply a rule to PRs with any of several milestones:
Pattern Matching
Apply a rule to PRs with milestones matching a pattern:
Require Any Milestone
Apply a rule only to PRs that have any milestone set:
Exclude Milestones
Apply a rule only to PRs that don’t have specific milestones:
Pattern Matching
The Milestone Filter supports several pattern matching methods:
- Exact match:
"v2.0.0"
- Glob patterns:
"v2.*"
- Regular expressions:
"/^v2\\.\\d+\\.\\d+$/"
(enclosed in forward slashes)
How It Works
Get Milestone
The filter retrieves the milestone associated with the PR, if any
Check Required
If required
is true, it checks that a milestone is set
Check Match Patterns
If match
is specified, it checks if the milestone title matches any of the patterns
Check Ignore Patterns
If ignore
is specified, it checks if the milestone title matches any of the ignore patterns
Determine Result
Returns a match result based on whether the milestone satisfies all conditions
Practical Use Cases
Release-Specific Rules
Apply different rules based on release milestones:
Milestone Requirement
Enforce that PRs have a milestone:
Different Tests by Release Type
Run different test requirements based on milestone:
Auto-Labeling by Milestone
Automatically add labels based on milestones:
Best Practices
Remember that milestones need to be created manually before they can be assigned to PRs
Integration with Release Process
The Milestone Filter works best as part of a comprehensive release process:
- Create Milestones: Create milestones for upcoming releases in GitHub
- Assign PRs: Require all PRs to be assigned to a milestone
- Filter Rules: Use the Milestone Filter to apply different requirements based on the target release
- Tracking: Use GitHub’s milestone view to track progress toward releases
- Release Notes: Generate release notes based on PRs in each milestone
This approach helps maintain a clear connection between changes and releases.