Frontend & UI Rules¶
Detect changes to user interface components and styling.
Rules in this Category¶
| Rule Name | Label | Description |
|---|---|---|
ui-change |
ui-change |
Frontend component files modified |
style-change |
style-change |
Style-only changes (no logic) |
ui-change¶
Detects changes to frontend and UI component files.
Detection Logic¶
Applies the ui-change label when any file with these extensions is modified:
.html— HTML templates.css/.scss/.sass/.less— Stylesheets.jsx/.tsx— React components.vue— Vue components
Use Cases¶
- ✅ Track all UI/frontend changes
- ✅ Route to frontend reviewers
- ✅ Trigger visual regression tests
- ✅ Monitor UI stability
Configuration¶
Examples¶
Code Implementation¶
View Source Code
module.exports = function uiChangeRule({ files, pr, enableDebug }) {
const labels = [];
const uiExtensions = ['.html', '.css', '.scss', '.sass', '.less', '.jsx', '.tsx', '.vue'];
let hasUIChanges = false;
for (const file of files) {
if (!file.filename) continue;
const filename = file.filename.toLowerCase();
const ext = filename.substring(filename.lastIndexOf('.'));
if (uiExtensions.includes(ext)) {
hasUIChanges = true;
if (enableDebug) {
console.log(`[UI Change Rule] UI file detected: ${filename}`);
}
break;
}
}
if (hasUIChanges) {
labels.push('ui-change');
}
return labels;
};
style-change¶
Detects style-only changes (CSS/SCSS without JavaScript).
Detection Logic¶
Applies the style-change label when:
- Only style files are changed (
.css,.scss,.sass,.less) - No JavaScript/TypeScript files changed
This rule helps identify purely cosmetic changes that don't affect logic.
Use Cases¶
- ✅ Fast-track style-only PRs
- ✅ Skip logic-heavy reviews
- ✅ Identify low-risk changes
- ✅ Separate styling from functionality
Configuration¶
Examples¶
Common Patterns¶
Frontend Team Workflow¶
Enable both rules to differentiate logic from styling:
Outcome:
- Pure CSS changes →
ui-change+style-change - Component changes →
ui-changeonly - Mixed changes →
ui-changeonly
Visual Testing Integration¶
Trigger visual regression tests on UI changes:
jobs:
label:
uses: workflow-kit/pr-auto-labeler/.github/workflows/pr-auto-labeler.yml@latest
with:
enabled_rules: '["ui-change"]'
visual-tests:
needs: label
if: contains(github.event.pull_request.labels.*.name, 'ui-change')
runs-on: ubuntu-latest
steps:
- name: Run visual regression tests
run: npm run test:visual
Require Frontend Review¶
Use GitHub branch protection to require reviews:
- Enable
ui-changerule - In repository settings → Branches → Branch protection
- Add rule: "Require review from Code Owners"
-
Create
CODEOWNERSfile:
Troubleshooting¶
Rule not triggering?
Check:
- ✅ File extensions match (case-insensitive)
- ✅ Files are actually in the PR diff
- ✅ Enable debug mode to see detected files
Both rules applying when I only want one?
ui-changeapplies to all UI files (CSS + JS)style-changeapplies only to CSS files without JS
If you change only CSS, both rules will match. This is expected behavior.
Related Rules¶
- test-missing 🧪 — Check if UI changes include tests
- dependency-change 📦 — Track UI library updates
- refactor 🔄 — Detect UI refactoring