Automatically label your pull requests based on code changes, patterns, and metadata. Set up in 2 minutes.
Labels are automatically applied to your pull requests based on the changes made - no manual effort required!
Create .github/workflows/pr-labeler.yml:
name: Auto Label PRs
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
label:
uses: workflow-kit/pr-auto-labeler/.github/workflows/pr-auto-labeler.yml@v0.0.1
with:
# ⚠️ IMPORTANT: Enable the rules you want (all disabled by default)
enabled_rules: '["ui-change", "env-change", "potential-secret-leak", "large-pr", "test-missing"]'git add .github/workflows/pr-labeler.yml
git commit -m "Add PR auto-labeler"
git pushCreate a pull request and labels will be applied automatically based on your enabled rules.
Choose which rules to enable from the comprehensive list below. All rules are disabled by default - you must explicitly enable the ones you want.
| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
ui-change |
🟢 ui-change |
Frontend component files (.jsx, .tsx, .vue, .html) |
Track UI/component changes |
style-change |
🟣 style-change |
Style-only changes (.css, .scss, .sass without JS) |
Identify cosmetic-only changes |
Example:
enabled_rules: '["ui-change", "style-change"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
migration |
🔵 migration |
Migration files in migrations/, db/migrations/ |
Track all DB migrations |
risky-migration |
🔴 risky-migration |
Dangerous SQL operations (DROP, TRUNCATE, ALTER DROP) | Flag high-risk migrations |
schema-change |
🟡 schema-change |
Schema modifications (ALTER, RENAME, MODIFY COLUMN) | Track schema changes |
safe-migration |
🟢 safe-migration |
Safe additive migrations (CREATE, INSERT, ADD COLUMN) | Identify low-risk migrations |
Example:
enabled_rules: '["migration", "risky-migration", "safe-migration"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
env-change |
🟠 env-change |
Environment files (.env, config.yml, config.json) |
Track configuration changes |
new-env-variable |
🟡 new-env-variable |
New environment variables added in diffs | Flag new configuration |
potential-secret-leak |
🔴 potential-secret-leak |
Keywords: API_KEY, PASSWORD, SECRET, TOKEN |
Security review required |
Example:
enabled_rules: '["env-change", "new-env-variable", "potential-secret-leak"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
test-only-change |
🟢 test-only-change |
Only test files modified, no source changes | Fast-track test improvements |
test-missing |
🔴 test-missing |
Source code changed without corresponding test changes | Require tests for code changes |
test-improvement |
🟡 test-improvement |
Tests added/improved with source changes | Acknowledge good testing practices |
Example:
enabled_rules: '["test-only-change", "test-missing", "test-improvement"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
dependency-change |
🟠 dependency-change |
Changes to package.json, requirements.txt, Gemfile, etc. |
Track dependency updates |
new-dependency |
🟡 new-dependency |
New dependencies added to project | Review new external dependencies |
dependency-downgrade |
🔴 dependency-downgrade |
Dependency versions downgraded | Flag potential security/compatibility issues |
Example:
enabled_rules: '["dependency-change", "new-dependency", "dependency-downgrade"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
ci-change |
🔵 ci-change |
CI workflow changes (GitHub Actions, GitLab CI, CircleCI, Jenkins) | Track CI/CD modifications |
docker-change |
⚫ docker-change |
Docker files (Dockerfile, docker-compose.yml, .dockerignore) |
Track containerization changes |
infra-change |
🟣 infra-change |
Infrastructure configs (Terraform, Kubernetes, Helm, Ansible) | Track infrastructure as code |
Example:
enabled_rules: '["ci-change", "docker-change", "infra-change"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
security-change |
🔴 security-change |
Changes in security-sensitive areas (auth, crypto, JWT, OAuth) | Require security review |
risky-code |
🔴 risky-code |
Dangerous patterns (eval, exec, dangerouslySetInnerHTML) |
Flag potentially unsafe code |
Example:
enabled_rules: '["security-change", "risky-code"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
function-removed |
🔴 function-removed |
Functions or classes removed from codebase | Flag breaking changes |
new-feature |
🟢 new-feature |
New features added (new files, "feat:" commits) | Highlight feature additions |
non-functional-change |
⚪ non-functional-change |
Documentation/text-only changes (no code) | Fast-track doc updates |
refactor |
🟡 refactor |
Code refactoring or multiple file renames | Identify code cleanup |
Example:
enabled_rules: '["function-removed", "new-feature", "refactor"]'| Rule Name | Label | Detects | Use Case |
|---|---|---|---|
large-pr |
🔴 large-pr |
PRs with >500 lines changed | Flag PRs that need splitting |
missing-description |
🟡 missing-description |
PR description <30 characters | Require better PR descriptions |
no-linked-issue |
🟡 no-linked-issue |
No issue linked (Closes #123, Fixes #456) |
Ensure issue tracking |
work-in-progress |
🟠 work-in-progress |
Draft PRs or titles with "WIP", "DNM" | Flag incomplete work |
Example:
enabled_rules: '["large-pr", "missing-description", "no-linked-issue", "work-in-progress"]'enabled_rules: '[
"ui-change", "style-change",
"test-missing", "test-improvement",
"dependency-change", "new-dependency",
"large-pr", "missing-description"
]'enabled_rules: '[
"potential-secret-leak",
"security-change",
"risky-code",
"risky-migration",
"dependency-downgrade"
]'enabled_rules: '[
"ui-change",
"style-change",
"test-missing",
"dependency-change"
]'enabled_rules: '[
"migration",
"risky-migration",
"safe-migration",
"test-missing",
"new-dependency"
]'enabled_rules: '[
"ci-change",
"docker-change",
"infra-change",
"env-change",
"security-change"
]'enabled_rules: '[
"large-pr",
"test-missing",
"missing-description",
"no-linked-issue",
"risky-code"
]'Override default label names with your own:
enabled_rules: '["ui-change", "test-missing"]'
label_overrides: '{
"ui-change": "frontend",
"test-missing": "needs-tests"
}'
# Will apply "frontend" and "needs-tests" labels insteadEnable detailed logging to troubleshoot rule execution:
enabled_rules: '["ui-change"]'
enable_debug: true
# Shows: files analyzed, rules executed, patterns matched, labels appliedname: Auto Label PRs
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
label:
uses: workflow-kit/pr-auto-labeler/.github/workflows/pr-auto-labeler.yml@v0.0.1
with:
enabled_rules: '[
"ui-change",
"test-missing",
"potential-secret-leak",
"large-pr",
"missing-description"
]'
label_overrides: '{
"ui-change": "frontend",
"test-missing": "needs-tests"
}'
enable_debug: false| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
enabled_rules |
JSON Array | ✅ Yes | [] |
List of rule names to enable |
label_overrides |
JSON Object | No | {} |
Custom label name mappings |
enable_debug |
Boolean | No | false |
Enable verbose debug logging |
-
Check if rules are enabled - All rules are disabled by default!
enabled_rules: '["ui-change"]' # Must not be empty!
-
Enable debug mode to see execution details:
enable_debug: true
-
Check workflow logs for messages:
⚠️ No rules enabled- Add rules toenabled_rules⚠️ No rules loaded- Check rule names are correct✅ Applied labels: [...]- Shows which labels were applied
- ✅ Verify file location:
.github/workflows/pr-labeler.yml - ✅ Check
permissionsblock includespull-requests: write - ✅ Ensure GitHub Actions is enabled in repository settings
- ✅ Confirm PR trigger is set:
on: pull_request:
- ✅ Check rule name spelling in
enabled_rules - ✅ Enable
enable_debug: trueto see which rules execute - ✅ Verify your changes match the rule's detection patterns
- ✅ Check if
label_overrideshas typos
Changed files: src/components/Button.tsx, styles/button.css
Config:
enabled_rules: '["ui-change", "style-change", "test-missing"]'Result: Gets labels ui-change, style-change, and test-missing (if no test changes)
Changed files: db/migrations/20240101_add_users.sql with CREATE TABLE users
Config:
enabled_rules: '["migration", "safe-migration", "risky-migration"]'Result: Gets labels migration and safe-migration (CREATE is safe)
Changed files: src/auth/login.ts, added eval(userInput)
Config:
enabled_rules: '["security-change", "risky-code", "test-missing"]'Result: Gets all three labels - requires security review!
Changed files: 15 files, 800 lines changed, multiple renames
Config:
enabled_rules: '["large-pr", "refactor", "test-missing"]'Result: Gets large-pr (>500 lines), refactor (many renames)
Begin with 3-5 essential rules, then expand:
enabled_rules: '["large-pr", "test-missing", "potential-secret-leak"]'Group rules by concern:
# Security bundle
enabled_rules: '["security-change", "risky-code", "potential-secret-leak"]'Match your team's existing label conventions:
label_overrides: '{"ui-change": "area/frontend", "test-missing": "needs-tests"}'When adding new rules, debug first:
enable_debug: true # Remove after verifyingWant to add a new rule or improve existing ones? See CONTRIBUTING.md for:
- Rule development guide
- Testing requirements
- How to test locally
- Contribution workflow
Want to see how widely this action is used? Here's what the badges track:
| Badge | What It Measures | Why It Matters |
|---|---|---|
| ⭐ Stars | Community interest & endorsement | Shows how many developers find this useful |
| 🔱 Forks | Active usage & customization | Indicates real adoption (people building on it) |
| 👁️ Watchers | Active monitoring | Shows engaged users tracking updates |
| 🔗 Used by | Public repos using this action | Direct measure of adoption in production |
| 📝 Issues/PRs | Community engagement | Shows active maintenance & support |
Note: GitHub only tracks public repository usage. Private repos using this action won't appear in these metrics, so actual usage is likely 2-5x higher than shown.
Once published to GitHub Marketplace (coming soon!), you'll get access to:
- ✅ Download counts
- ✅ Installation metrics
- ✅ Usage trends over time
- ✅ Geographic distribution
The Marketplace insights will be available at: github.com/marketplace/actions/YOUR-ACTION-NAME (after publication).
- 📖 Design Philosophy: docs/DESIGN.md
- 🤝 Contributing Guide: CONTRIBUTING.md
- 💬 Discussions: GitHub Discussions
- 🐛 Report Issues: GitHub Issues
MIT License - see LICENSE for details.
Made with ❤️ by the open-source community
⭐ Star this repo if it helps your workflow!
