| applyTo | ** |
|---|---|
| description | Canonical instructions for the unified labeling automation system. Describes mission, strategy, configuration, and best practices for label management across issues, PRs, and discussions. |
You are a unified labelling automation assistant. Follow our config-driven labelling framework to apply and enforce canonical labels across issues, PRs, and discussions. Avoid hardcoded label logic, non-canonical names, or bypassing one-hot constraints unless explicitly justified.
Applies to labelling automation across issues, PRs, and discussions. Covers mission, strategy, execution flow, config files, and best practices. Excludes manual triage policies outside the documented label families.
- Use the canonical YAML configs (
labels.yml,labeler.yml,issue-types.yml) as the single source of truth. - Enforce one-hot constraints for
status:*,priority:*, andtype:*. - Standardise labels to canonical names; avoid hardcoded logic.
- Generate audit reports as part of automation.
- Follow the Mission, Strategy, Process, and Configuration sections below.
- Use the execution flow to structure automation and reporting.
- Good: Apply
type:feature,status:needs-review,priority:normalvia branch + file rules; migrateenhancementtotype:featureusing aliases. - Avoid: Adding labels not defined in
labels.ymlor leaving multiplestatus:*labels on an item.
- Validate YAML configs against schemas where provided.
- Run labeling workflow dry-runs when adding new rules.
- Check audit reports for one-hot enforcement and alias migrations.
Automate the application, enforcement, and standardization of labels across issues, pull requests, and discussions. The unified labeling system uses a config-driven architecture where three canonical YAML files define all labeling logic, eliminating hardcoded rules and ensuring consistency across the organization.
The labeling system operates on two complementary principles:
-
Config-Driven Architecture: All labeling rules, definitions, and type mappings are stored in three canonical YAML files (not in code):
.github/labels.yml— Canonical label definitions (names, colors, descriptions, aliases).github/labeler.yml— Pattern-to-label rules (branch prefixes, file paths).github/issue-types.yml— Issue template type-to-label mappings
-
Agent-Driven Automation: A unified agent (
labeling.agent.md,labeling.agent.js) orchestrates all labeling tasks:- Fetches rules from canonical configuration files
- Applies labels based on file changes, branch patterns, and content heuristics
- Enforces one-hot constraints (exactly one
status:*,priority:*, andtype:*per issue/PR) - Standardizes non-canonical labels to match the canonical set
- Generates audit reports and optional GitHub artifacts
The labeling system follows this 7-step execution flow:
- Triggered: GitHub Actions workflow (
labeling.yml) detects issue, PR, or discussion event - Fetch Config: Agent fetches canonical rules from three YAML files
- Analyze: Determine which labels should apply based on:
- File changes (via
labeler.ymlpatterns) - Branch names (via
labeler.ymlbranch patterns) - Issue type or template (via
issue-types.yml) - Content heuristics (commit messages, issue body, PR description)
- File changes (via
- Apply: Add labels that match canonical set in
labels.yml - Enforce: Remove conflicting labels (e.g., ensure only one
status:*) - Standardize: Migrate non-canonical labels to canonical equivalents (using aliases if defined)
- Report: Generate audit summary and optionally commit to repository
Location: .github/labels.yml (formerly stored in the retired automation folder)
Purpose: Master registry of all labels used in the organisation.
Structure:
- Each label is defined with
name,color, anddescription - Labels are organised by category (status, priority, type, area, meta, release, etc.)
- Optional
aliasesfield maps legacy label names to canonical versions for migration - No label is created or used outside this file
Key Categories:
- Status (
status:*) — Workflow progression (needs-triage, in-progress, done, blocked) - Priority (
priority:*) — Urgency scale (critical, important, normal, minor) - Type (
type:*) — Work classification (bug, feature, documentation, test, refactor, etc.) - Area (
area:*) — Codebase surfaces (block-editor, theme, ci, documentation, etc.) - Component (
comp:*) — Specific subsystems (block-inserter, pattern-library, etc.) - Meta (
meta:*) — Housekeeping signals (needs-changelog, stale, has-pr, etc.) - Release (
release:*) — Semantic versioning scope (patch, minor, major, hotfix) - Language (
lang:*) — Code language tags (php, js, css, etc.) - Discussion (
discussion:*) — Community categories (announcement, showcase, support, etc.) - AI Ops (
ai-ops:*) — Automation tracking (agents, instructions, prompts, tools) - Contributor (
contrib:*) — Contributor workflow (good-first-issue, help-wanted) - Compatibility (
compat:*) — Version/platform compatibility (wordpress, woocommerce, php, etc.)
Example Label Definition:
- name: status:needs-review
color: BFD4F2
description: "Awaiting code review"Example with Alias (for migration):
- name: type:feature
color: 3FB950
description: "Feature or enhancement"
aliases: ["enhancement", "feature-request"] # Legacy names automatically migratedLocation: .github/labeler.yml (formerly stored in the retired automation folder)
Purpose: Rules engine mapping file patterns and branch names to labels.
Structure:
- Each label can have
head-branchpatterns (branch name regex matching) - Each label can have
changed-filespatterns (file path glob matching) - Patterns are tested against each PR or push event
- Supports both
any-glob-to-any-file(OR logic) andall-globs-to-all-files(AND logic)
Common Patterns:
- Branch Prefixes:
feat/*, fix/*, docs/*, chore/*, refactor/*, test/*, perf/*- Maps to corresponding type labels (e.g.,
feat/*→type:feature) - Status labels (e.g.,
feat/*orfix/*→status:needs-review)
- Maps to corresponding type labels (e.g.,
- File Paths:
src/blocks/**, **/theme.json, .github/workflows/**, docs/**- Maps to area labels (e.g.,
src/blocks/**→area:block-editor) - Maps to language labels (e.g.,
**/*.php→lang:php)
- Maps to area labels (e.g.,
- Language Detection:
**/*.{js,ts},**/*.{css,scss},**/*.php- Automatically applied based on changed file extensions
Example Rule:
"type:feature":
head-branch: ["^feat/.*"]
"area:block-editor":
changed-files:
any-glob-to-any-file:
- "src/blocks/**"
- "**/block.json"Location: .github/issue-types.yml (formerly stored in the retired automation folder)
Purpose: Maps issue template types to canonical label definitions.
Structure:
- Lists all supported issue types used in templates
- Each type has a
name,color, and correspondinglabelfield - Used by issue creation workflow to pre-assign labels
- Provides consistent color/label mapping across templates
Example Type Definition:
- name: Bug
color: 9F3734
label: type:bugGitHub Event (issue/PR/discussion)
↓
labeling.yml Workflow Triggered
↓
Fetch Canonical Rules
├── labels.yml (definitions & aliases)
├── labeler.yml (branch & file patterns)
└── issue-types.yml (template mappings)
↓
Analyze Item
├── Check changed files (PRs)
├── Check branch name (PRs)
├── Check issue template type
└── Apply content heuristics
↓
Apply Matching Labels
├── Add canonical labels found
└── Respect existing labels
↓
Enforce Constraints
├── One-hot: Ensure exactly one status:*
├── One-hot: Ensure exactly one priority:*
└── One-hot: Ensure exactly one type:*
↓
Standardize Non-Canonical
├── Find aliases in labels.yml
└── Migrate legacy → canonical
↓
Generate Report
├── Audit log (what was applied/removed)
└── Optional: Commit to .github/reports/
↓
Complete
DO:
- Always reference
.github/labels.ymlas the source of truth for label definitions - Keep labeler rules in
.github/labeler.ymlsimple and maintainable - Use branch prefixes (
feat/,fix/,docs/) consistently across the org - Test new labeler rules in dry-run mode before committing
- Document complex labeling logic as comments in
labeler.yml - Log all labeling actions for audit trails
- Use aliases in
labels.ymlfor graceful migration of legacy label names
DON'T:
- Don't create labels outside of
.github/labels.yml - Don't hardcode label lists in workflows or scripts
- Don't apply multiple
status:*orpriority:*labels (one-hot enforcement will correct) - Don't create labels on-the-fly in GitHub UI (they won't be tracked in config)
- Don't apply non-canonical labels when canonical equivalents exist
-
Canonical Label Enforcement: Only labels defined in
.github/labels.ymlare considered valid. Any non-canonical labels are logged as warnings. -
One-Hot Enforcement: The agent ensures:
- Exactly one
status:*label per issue/PR (removes conflicts, applies default if missing) - Exactly one
priority:*label per issue/PR (removes conflicts, applies default if missing) - Exactly one
type:*label per issue/PR (removes conflicts)
- Exactly one
-
Dry-Run Mode: Set
DRY_RUN=truein workflow inputs to preview label changes without applying them -
User Override Respect: If a user manually adds labels, the agent respects them unless they conflict with one-hot constraints
-
Audit Trail: All label changes are logged with reasons (file-based, branch-based, type-based, heuristic-based, or manual)
-
Configuration Validation: On every run, the agent validates that all rules in
labeler.ymlreference labels that exist inlabels.yml
The labeling system produces:
- Updated Labels on Issue/PR: Labels are applied based on rules and constraints
- Workflow Summary: Logged to workflow run output showing which labels were applied/removed and why
- Optional Artifact: If
report_commit=true, an audit report is generated and committed to.github/reports/labeling/ - Audit Log: Available in workflow logs for debugging and compliance
| Component | File | Purpose |
|---|---|---|
| Agent Spec | ../agents/labeling.agent.md | Master specification and configuration |
| Workflow | .github/workflows/labeling.yml | GitHub Actions automation trigger |
| Labels | .github/labels.yml | Canonical label definitions |
| Rules | .github/labeler.yml | Pattern-to-label mapping engine |
| Types | .github/issue-types.yml | Issue type to label mappings |
| Implementation | scripts/agents/labeling.agent.js |
Main orchestration logic |
| Tests | __tests__/labeling.agent.*.test.js |
Unit and integration tests |
| Strategy | docs/LABEL_STRATEGY.md | Label philosophy and strategy |
| Governance | docs/AUTOMATION_GOVERNANCE.md | Organization automation policies |
Q: Labels aren't being applied to my PR
A: Check the following in order:
- Verify the label is defined in
.github/labels.yml(if not, add it) - Check
.github/labeler.ymlfor matching rules (branch name or file path patterns) - If branch name pattern, verify your branch follows the expected convention (e.g.,
feat/,fix/) - Review workflow logs in GitHub Actions for the exact reason labels weren't applied
- Test rule in dry-run mode to preview without applying
Q: I see duplicate or conflicting labels
A: This shouldn't happen with one-hot enforcement, but if it does:
- Check if manually-applied label conflicts with rule-based labels
- Run labeling workflow again (it will enforce constraints)
- Review workflow logs to identify the conflict reason
- If issue persists, check
.github/labeler.ymlfor conflicting patterns
Q: A label I added isn't in the canonical set
A: All labels must be defined in .github/labels.yml first. To add a new label:
- Add the label definition to
.github/labels.ymlwith name, color, and description - Create labeler rules in
.github/labeler.ymlif the label should be auto-applied - Commit changes to repository
- The agent will automatically use the new label in future runs
Q: Why did my old label get replaced?
A: The agent performs alias-based migration for legacy label names. If you see a label migration:
- Check
.github/labels.ymlforaliasesfield in the new label definition - Your old label name is listed as an alias and was automatically standardized
- The new canonical label name should now be used going forward
- Triggered on issue/PR open, update, or label events (
labeling.yml). - Analyse content, files, and metadata.
- Apply or remove labels based on
.github/labels.yml,.github/labeler.yml, and.github/issue-types.yml. - Enforce required labels (
status:*,priority:*,type:*). - Remove redundant or conflicting labels.
- Presence of status, priority, and type labels.
- File path, branch, and frontmatter-based label mapping.
- Conflict and redundancy resolution.
- Keep label logic DRY and agent-driven.
- Allow per-repo config (
labels.yml,labeler.yml).
- Only apply existing labels.
- Never overwrite user-applied labels without warning.
- Log all label actions.
- Updated labels on issues and pull requests.
- Action logs.
- labels.yml
- labeler.yml
- issue-types.yml
- instructions.instructions.md
- workflows.instructions.md
- Labeling Agent Specification
- Label Strategy Philosophy
- Automation Governance Policies
- Issue Creation Guide
- Pull Request Creation Process
- GitHub Actions Labeler Documentation
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs