Skip to content

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)

Learn More โ†’

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

Learn More โ†’

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

Learn More โ†’

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

Learn More โ†’

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

Learn More โ†’

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

Learn More โ†’

Rule Label Detection
security-change security-change Auth, crypto, JWT, OAuth changes
risky-code risky-code eval, exec, dangerouslySetInnerHTML

Learn More โ†’

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

Learn More โ†’

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

Learn More โ†’


Common Rule Combinations

๐ŸŽจ Frontend Team

Focus on UI changes, testing, and dependencies:

enabled_rules: '[
  "ui-change",
  "style-change",
  "test-missing",
  "dependency-change"
]'

๐Ÿ—„๏ธ 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:

  1. Analyzes PR data โ€” Changed files, diffs, metadata
  2. Applies detection patterns โ€” File paths, content patterns, PR properties
  3. Returns labels โ€” List of labels to apply (can be empty)
  4. 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:

large_pr_threshold: '300'  # Default is 500

Debug Mode

Enable detailed logging to understand rule execution:

enable_debug: true

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:

  1. ๐ŸŽจ Frontend & UI Rules
  2. ๐Ÿ—„๏ธ Database Rules
  3. โš™๏ธ Environment & Config Rules
  4. ๐Ÿงช Testing Rules
  5. ๐Ÿ“ฆ Dependency Rules
  6. โ˜๏ธ CI/CD & Infrastructure Rules
  7. ๐Ÿ”’ Security Rules
  8. ๐Ÿ’ป Code Semantics Rules
  9. ๐Ÿ“„ PR Metadata Rules

Or jump to: