Rules Reference¶
Complete guide to all 30+ labeling rules available in PR Auto-Labeler.
Overview¶
Rules are organized into 9 categories based on what they detect. Each rule:
- โ Is disabled by default โ you explicitly enable what you need
- ๐ฏ Has a specific purpose โ detects one type of change
- ๐ท๏ธ Applies one or more labels โ can be customized
- ๐ Includes detailed detection logic โ transparent and predictable
How to Choose Rules
Start small: Enable 3-5 rules that matter most to your team
Test first: Use debug mode to see how rules behave
Expand gradually: Add more rules as you see value
Rule Categories¶
-
๐จ Frontend & UI
Detect changes to UI components and styles
2 rules | View Details โ
-
๐๏ธ Database
Track migrations and schema changes
4 rules | View Details โ
-
โ๏ธ Environment & Config
Monitor configuration and environment changes
3 rules | View Details โ
-
๐งช Testing
Ensure test coverage and quality
3 rules | View Details โ
-
๐ฆ Dependencies
Track dependency additions and updates
3 rules | View Details โ
-
โ๏ธ CI/CD & Infrastructure
Monitor infrastructure and deployment configs
3 rules | View Details โ
-
๐ Security
Flag security-sensitive changes
2 rules | View Details โ
-
๐ป Code Semantics
Detect feature additions, refactors, and breaking changes
4 rules | View Details โ
-
๐ PR Metadata
Check PR size, description, and metadata quality
4 rules | View Details โ
Quick Reference¶
All Rules at a Glance¶
| Rule | Label | Detection |
|---|---|---|
ui-change |
ui-change |
.jsx, .tsx, .vue, .html files |
style-change |
style-change |
.css, .scss, .sass only (no JS) |
| Rule | Label | Detection |
|---|---|---|
migration |
migration |
Files in migrations/ directories |
risky-migration |
risky-migration |
DROP, TRUNCATE operations |
safe-migration |
safe-migration |
CREATE, INSERT, ADD operations |
schema-change |
schema-change |
ALTER, MODIFY COLUMN operations |
| Rule | Label | Detection |
|---|---|---|
env-change |
env-change |
.env, config.yml, config.json |
new-env-variable |
new-env-variable |
New vars in diffs |
potential-secret-leak |
potential-secret-leak |
API_KEY, PASSWORD, SECRET |
| Rule | Label | Detection |
|---|---|---|
test-only-change |
test-only-change |
Only test files changed |
test-missing |
test-missing |
Code changed, no test changes |
test-improvement |
test-improvement |
Tests + code changed |
| Rule | Label | Detection |
|---|---|---|
dependency-change |
dependency-change |
package.json, requirements.txt, etc. |
new-dependency |
new-dependency |
New packages added |
dependency-downgrade |
dependency-downgrade |
Version downgraded |
| Rule | Label | Detection |
|---|---|---|
ci-change |
ci-change |
.github/workflows/, .gitlab-ci.yml |
docker-change |
docker-change |
Dockerfile, docker-compose.yml |
infra-change |
infra-change |
Terraform, Kubernetes, Helm configs |
| Rule | Label | Detection |
|---|---|---|
security-change |
security-change |
Auth, crypto, JWT, OAuth changes |
risky-code |
risky-code |
eval, exec, dangerouslySetInnerHTML |
| Rule | Label | Detection |
|---|---|---|
function-removed |
function-removed |
Functions/classes deleted |
new-feature |
new-feature |
New files, "feat:" commits |
non-functional-change |
non-functional-change |
Docs/text only |
refactor |
refactor |
Multiple renames, restructuring |
| Rule | Label | Detection |
|---|---|---|
large-pr |
large-pr |
>500 lines changed (configurable) |
missing-description |
missing-description |
PR description <30 chars |
no-linked-issue |
no-linked-issue |
No "Closes #123" or "Fixes #456" |
work-in-progress |
work-in-progress |
Draft PR or "WIP"/"DNM" in title |
Common Rule Combinations¶
๐จ Frontend Team¶
Focus on UI changes, testing, and dependencies:
๐๏ธ Backend Team¶
Track database, security, and testing:
enabled_rules: '[
"migration",
"risky-migration",
"test-missing",
"security-change",
"new-dependency"
]'
๐ Security-Focused¶
Flag all security-related changes:
enabled_rules: '[
"potential-secret-leak",
"security-change",
"risky-code",
"risky-migration",
"dependency-downgrade",
"env-change"
]'
โ๏ธ DevOps Team¶
Monitor infrastructure and CI/CD:
enabled_rules: '[
"ci-change",
"docker-change",
"infra-change",
"env-change",
"dependency-change"
]'
๐ Quality Enforcement¶
Enforce PR quality standards:
enabled_rules: '[
"large-pr",
"test-missing",
"missing-description",
"no-linked-issue",
"work-in-progress"
]'
Rule Behavior¶
Detection Logic¶
Each rule:
- Analyzes PR data โ Changed files, diffs, metadata
- Applies detection patterns โ File paths, content patterns, PR properties
- Returns labels โ List of labels to apply (can be empty)
- Logs activity โ When debug mode is enabled
Label Application¶
- Labels are applied cumulatively โ multiple rules can add labels
- Labels are added, not replaced โ existing labels remain
- Labels are created automatically โ if they don't exist in the repo
- Labels can be customized โ via
label_overrides
Performance¶
- All rules run in parallel where possible
- Average execution time: 2-5 seconds for typical PRs
- Rules are stateless โ no side effects or dependencies
Customization¶
Override Label Names¶
Match your team's existing label conventions:
label_overrides: '{
"ui-change": "area/frontend",
"test-missing": "needs-tests",
"large-pr": "size/XL",
"security-change": "security-review-required"
}'
Adjust Thresholds¶
Customize the large PR threshold:
Debug Mode¶
Enable detailed logging to understand rule execution:
Debug output includes:
- Files being analyzed
- Rules being evaluated
- Pattern matches found
- Labels being applied
- Execution time per rule
Debug Output Example
[UI Change Rule] UI file detected: src/components/Button.tsx
[UI Change Rule] Labels to apply: ui-change
[Test Missing Rule] Source changed: src/components/Button.tsx
[Test Missing Rule] No test changes detected
[Test Missing Rule] Labels to apply: test-missing
โ
Applied labels: ui-change, test-missing
Next Steps¶
Explore detailed documentation for each rule category:
- ๐จ Frontend & UI Rules
- ๐๏ธ Database Rules
- โ๏ธ Environment & Config Rules
- ๐งช Testing Rules
- ๐ฆ Dependency Rules
- โ๏ธ CI/CD & Infrastructure Rules
- ๐ Security Rules
- ๐ป Code Semantics Rules
- ๐ PR Metadata Rules
Or jump to: