Description Filter
Filter rules based on PR description content
The Description Filter allows you to apply rules only when a pull request’s description contains (or doesn’t contain) specific content. This helps target rules based on the context or purpose described in the PR.
Configuration
Must be set to "description"
Pattern(s) that the description should match (supports regex)
Pattern(s) that the description should not match (supports regex)
Basic Usage
Examples
Match Specific Text
Apply a rule only when the description contains specific text:
Match Multiple Patterns
Apply a rule when the description matches any of several patterns:
Exclude Patterns
Apply a rule only when the description doesn’t mention something:
Combined Matching
Apply a rule with both inclusion and exclusion patterns:
Pattern Matching
The Description Filter supports several pattern matching methods:
- Simple substring:
"breaking change"
- Regular expressions:
"/fixes #\\d+/i"
(enclosed in forward slashes)
For case-insensitive matching with regex, use the i
flag: "/breaking change/i"
How It Works
Get Description
The filter retrieves the PR description from the GitHub event context
Check Match Patterns
If match
is specified, it checks if the description matches any of the patterns
Check Ignore Patterns
If ignore
is specified, it checks if the description matches any of the ignore patterns
Determine Result
Returns a match result based on whether the description satisfies all conditions
Practical Use Cases
Breaking Changes Workflow
Apply special rules to breaking changes:
Issue References
Apply different rules based on whether a PR references an issue:
Release Notes Draft
Apply specific rules to PRs with draft release notes:
Work In Progress
Skip certain validations for work-in-progress PRs:
Best Practices
Regex patterns can become complex; test them thoroughly to ensure they match as expected
Integration with PR Templates
To make the most of the Description Filter, create a PR template with standard sections:
This template creates predictable sections that your Description Filter can target.