Configuration¶
Complete reference for all PR Auto-Labeler configuration options.
Configuration Parameters¶
enabled_rules¶
Type: JSON Array (string)
Required: Yes
Default: []
List of rule names to enable. All rules are disabled by default.
Important
If enabled_rules is empty or not provided, no labels will be applied. You must explicitly enable the rules you want.
All Available Rules
enabled_rules: '[
"ui-change", "style-change",
"migration", "risky-migration", "safe-migration", "schema-change",
"env-change", "new-env-variable", "potential-secret-leak",
"test-only-change", "test-missing", "test-improvement",
"dependency-change", "new-dependency", "dependency-downgrade",
"ci-change", "docker-change", "infra-change",
"security-change", "risky-code",
"function-removed", "new-feature", "non-functional-change", "refactor",
"large-pr", "missing-description", "no-linked-issue", "work-in-progress"
]'
label_overrides¶
Type: JSON Object (string)
Required: No
Default: {}
Override default label names with custom names.
with:
label_overrides: '{
"ui-change": "frontend",
"test-missing": "needs-tests",
"large-pr": "size/large"
}'
Use Cases:
- Match existing label conventions
- Use org-wide label standards
- Apply namespaced labels (e.g.,
area/frontend,size/large)
Label Name Requirements
Label names can contain alphanumeric characters, hyphens, underscores, and slashes. GitHub will create labels automatically if they don't exist.
large_pr_threshold¶
Type: Number (string)
Required: No
Default: 500
Number of changed lines that triggers the large-pr label.
Recommended Values:
| Team Type | Threshold | Rationale |
|---|---|---|
| Small teams | 300-400 | Encourage smaller, focused PRs |
| Medium teams | 500 | Balanced default |
| Large teams | 700-1000 | More flexibility for complex features |
enable_debug¶
Type: Boolean (string)
Required: No
Default: false
Enable verbose debug logging in workflow output.
Debug Output Includes:
- Files analyzed
- Rules evaluated
- Pattern matches found
- Labels applied
- Execution time per rule
When to Use Debug Mode
- Testing new rule configurations
- Troubleshooting why labels aren't applied
- Understanding rule behavior
- Reporting issues
Disable in production to reduce log verbosity.
Complete Configuration Example¶
Advanced Configuration¶
Conditional Execution¶
Run the labeler only on specific conditions:
Multiple Configurations¶
Run different rule sets based on file paths:
jobs:
label-frontend:
if: contains(github.event.pull_request.changed_files, 'frontend/')
uses: workflow-kit/pr-auto-labeler/.github/workflows/pr-auto-labeler.yml@latest
with:
enabled_rules: '["ui-change", "style-change", "test-missing"]'
label-backend:
if: contains(github.event.pull_request.changed_files, 'backend/')
uses: workflow-kit/pr-auto-labeler/.github/workflows/pr-auto-labeler.yml@latest
with:
enabled_rules: '["migration", "security-change", "test-missing"]'
Environment Variables¶
PR Auto-Labeler uses these environment variables internally:
| Variable | Description | Set By |
|---|---|---|
GITHUB_TOKEN |
GitHub API token | Automatically by GitHub Actions |
ENABLED_RULES |
Enabled rules list | From enabled_rules input |
LABEL_OVERRIDES |
Custom label mappings | From label_overrides input |
LARGE_PR_THRESHOLD |
Large PR threshold | From large_pr_threshold input |
ENABLE_DEBUG |
Debug mode flag | From enable_debug input |
Note
You don't need to set these manually — they're managed by the workflow.
Rule Categories¶
Rules are organized into categories. Here's a quick reference:
| Category | Rule Count | Enable All |
|---|---|---|
| Frontend & UI | 2 | ["ui-change", "style-change"] |
| Database | 4 | ["migration", "risky-migration", "safe-migration", "schema-change"] |
| Environment | 3 | ["env-change", "new-env-variable", "potential-secret-leak"] |
| Testing | 3 | ["test-only-change", "test-missing", "test-improvement"] |
| Dependencies | 3 | ["dependency-change", "new-dependency", "dependency-downgrade"] |
| CI/CD | 3 | ["ci-change", "docker-change", "infra-change"] |
| Security | 2 | ["security-change", "risky-code"] |
| Semantics | 4 | ["function-removed", "new-feature", "non-functional-change", "refactor"] |
| Metadata | 4 | ["large-pr", "missing-description", "no-linked-issue", "work-in-progress"] |
View Detailed Rules Reference →
Best Practices¶
Do's
✅ Start with 3-5 essential rules
✅ Enable debug mode when testing
✅ Use label overrides for consistency
✅ Group related rules together
✅ Document your rule choices for the team
Don'ts
❌ Don't enable all rules at once
❌ Don't forget to set enabled_rules
❌ Don't leave debug mode on in production
❌ Don't use invalid JSON in arrays/objects
❌ Don't skip the pull-requests: write permission
Migration Guide¶
From v0.0.1 to Latest¶
Update to use the workflow file path format:
uses: workflow-kit/pr-auto-labeler@v0.0.1
# Change to:
uses: workflow-kit/pr-auto-labeler/.github/workflows/pr-auto-labeler.yml@latest
Check the Changelog for breaking changes.