Skip to content

feat(labels): Make labels configurable with enable/disable and custom colors #976

@myakove

Description

@myakove

Summary

Add configuration options to:

  1. Enable/disable specific labels per repository
  2. Customize label colors via CSS3 color names
  3. Maintain backward compatibility (no config = current behavior)

Proposed Configuration

labels:
  # If not set, ALL labels are enabled (backward compatible)
  enabled-labels:
    - verified
    - hold
    - wip
    - needs-rebase
    - has-conflicts
    - can-be-merged
    - size              # All size/* labels
    - branch            # branch-* labels
    - cherry-pick       # cherry-pick-* labels
    - automerge

  # Optional: Override default colors (CSS3 color names)
  colors:
    hold: red
    verified: green
    approved-: green
    lgtm-: yellowgreen
    # ... etc

Label Categories

Category Labels Configurable
Status verified, hold, wip, needs-rebase, has-conflicts, can-be-merged, automerge Enable/Disable + Colors
Size size/XS, size/S, etc. Enable/Disable + Colors
Branch branch-{name} Enable/Disable + Colors
Reviewed-by approved-, lgtm-, changes-requested-, commented- Colors ONLY (cannot disable)
Cherry-pick cherry-pick-*, CherryPicked Enable/Disable + Colors

Important: reviewed-by Labels Are Always Enabled

The reviewed-by labels cannot be disabled because they are the only source of truth for the approval system. Disabling them would break:

  • minimum-lgtm requirement (counts lgtm-* labels)
  • Approval validation (counts approved-* labels)
  • Changes-requested blocking (checks changes-requested-* labels)
  • Auto-merge workflow

Files to Modify

  1. webhook_server/config/schema.yaml - Add labels schema
  2. webhook_server/utils/constants.py - Remove hardcoded colors
  3. webhook_server/libs/github_api.py - Load labels config
  4. webhook_server/libs/handlers/labels_handler.py - Check enabled + use configured colors
  5. webhook_server/libs/handlers/pull_request_handler.py - Conditional label operations
  6. webhook_server/libs/handlers/issue_comment_handler.py - Conditional /wip, /hold, /verified
  7. Tests and documentation

Acceptance Criteria

  • Labels can be enabled/disabled via config (except reviewed-by)
  • Label colors can be customized via CSS3 color names
  • No config = all labels enabled with default colors (backward compatible)
  • Schema validation works correctly
  • All tests pass
  • Documentation updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions