Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ local-run.sh
webhook-server.private-key.pem
log-colors.json
webhook_server/tests/manifests/logs


.coverage_report.txt
.cursor

# AI
.cursor/
CLAUDE.md
.agent-os/
.cursorrules
.claude/
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ GitHub Events → Webhook Server → Repository Management

- **Intelligent reviewer assignment** based on OWNERS files
- **Automated labeling** including size calculation and status tracking
- **Configurable PR size labels** with custom names, thresholds, and colors
- **Merge readiness validation** with comprehensive checks
- **Issue tracking** with automatic creation and lifecycle management

Expand Down Expand Up @@ -233,6 +234,23 @@ auto-verified-and-merged-users:
- "renovate[bot]"
- "dependabot[bot]"

# Global PR Size Labels (optional)
pr-size-thresholds:
Tiny:
threshold: 10
color: lightgray
Small:
threshold: 50
color: green
Medium:
threshold: 150
color: orange
Large:
threshold: 300
color: red

# Threshold rules: PRs with changes ≥ threshold and < next-threshold get that label

# Docker Registry Access
docker:
username: your-docker-username
Expand Down Expand Up @@ -277,6 +295,15 @@ repositories:
can-be-merged-required-labels:
- "approved"

# Repository-specific PR Size Labels (see global example above; values override at repository level)
pr-size-thresholds:
Express:
threshold: 25
color: lightblue
Standard:
threshold: 100
color: green

# Branch Protection
protected-branches:
main:
Expand All @@ -294,6 +321,72 @@ repositories:
- "trusted-bot[bot]"
```

### Configurable PR Size Labels

The webhook server supports configurable pull request size labels with custom names,
thresholds, and colors. This feature allows repository administrators to define
their own categorization system.

#### Configuration Options

```yaml
# Global configuration (applies to all repositories)
pr-size-thresholds:
Tiny:
threshold: 10 # Required: positive integer (lines changed)
color: lightgray # Optional: CSS3 color name, defaults to lightgray
Small:
threshold: 50
color: green
Medium:
threshold: 150
color: orange
Large:
threshold: 300
color: red

# Repository-specific configuration (overrides global)
repositories:
my-project:
name: my-org/my-project
pr-size-thresholds:
Express:
threshold: 25
color: lightblue
Standard:
threshold: 100
color: green
Premium:
threshold: 500
color: orange
```

#### Configuration Rules

- **threshold**: Required positive integer representing total lines changed
(additions + deletions)
- **color**: Optional CSS3 color name
(e.g., `red`, `green`, `orange`, `lightblue`, `darkred`)
- **Label Names**: Any string (e.g., `Tiny`, `Express`, `Premium`, `Critical`)
- **Hierarchy**: Repository-level configuration overrides global configuration
- **Fallback**: If no custom configuration is provided, uses default static labels
(XS, S, M, L, XL, XXL)

#### Supported Color Names

Any valid CSS3 color name is supported, including:

- Basic colors: `red`, `green`, `blue`, `orange`, `yellow`, `purple`
- Extended colors: `lightgray`, `darkred`, `lightblue`, `darkorange`
- Grayscale: `black`, `white`, `gray`, `lightgray`, `darkgray`

Invalid color names automatically fall back to `lightgray`.

#### Real-time Updates

Configuration changes take effect immediately without server restart. The webhook
server re-reads configuration for each incoming webhook event.

### Repository-Level Overrides

Create `.github-webhook-server.yaml` in your repository root to override or extend the global configuration for that specific repository. This file supports all repository-level configuration options.
Expand All @@ -312,6 +405,18 @@ set-auto-merge-prs:
- develop
pre-commit: true
conventional-title: "feat,fix,docs"

# Custom PR size labels for this repository
pr-size-thresholds:
Quick:
threshold: 20
color: lightgreen
Normal:
threshold: 100
color: green
Complex:
threshold: 300
color: orange
```

For a comprehensive example showing all available options, see [`examples/.github-webhook-server.yaml`](examples/.github-webhook-server.yaml).
Expand Down
18 changes: 18 additions & 0 deletions examples/.github-webhook-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,21 @@ minimum-lgtm: 2

# Issue creation for new pull requests
create-issue-for-new-pr: true # Create tracking issues for new PRs

# Custom PR size labels for this repository (overrides global configuration)
# Define custom categories based on total lines changed (additions + deletions)
# threshold: positive integer representing minimum lines changed for this category
# color: CSS3 color name (e.g., red, green, blue, lightgray, darkorange)
pr-size-thresholds:
Quick:
threshold: 20 # PRs with 0-19 lines changed
color: lightgreen
Normal:
threshold: 100 # PRs with 20-99 lines changed
color: green
Complex:
threshold: 300 # PRs with 100-299 lines changed
color: orange
Critical:
threshold: 1000 # PRs with 300-999 lines changed
color: darkred # PRs with 1000+ lines changed get this category
31 changes: 31 additions & 0 deletions examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ auto-verified-and-merged-users:

create-issue-for-new-pr: true # Global default: create tracking issues for new PRs

# Global PR size label configuration (optional)
# Define custom categories based on total lines changed (additions + deletions)
# threshold: positive integer representing minimum lines changed for this category
# color: CSS3 color name (e.g., red, green, blue, lightgray, darkorange)
pr-size-thresholds:
Tiny:
threshold: 10 # PRs with 0-9 lines changed
color: lightgray
Small:
threshold: 50 # PRs with 10-49 lines changed
color: green
Medium:
threshold: 150 # PRs with 50-149 lines changed
color: orange
Large:
threshold: 300 # PRs with 150-299 lines changed
color: red # PRs with 300+ lines changed get this category

branch-protection:
strict: True
require_code_owner_reviews: True
Expand Down Expand Up @@ -100,5 +118,18 @@ repositories:

minimum-lgtm: 0 # The minimum PR lgtm required before approve the PR
create-issue-for-new-pr: true # Override global setting: create tracking issues for new PRs (default: true)

# Repository-specific PR size labels (overrides global configuration)
pr-size-thresholds:
Express:
threshold: 25 # PRs with 0-24 lines changed
color: lightblue
Standard:
threshold: 100 # PRs with 25-99 lines changed
color: green
Premium:
threshold: 500 # PRs with 100-499 lines changed
color: orange # PRs with 500+ lines changed get this category

set-auto-merge-prs:
- main
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dependencies = [
"uvicorn>=0.31.0",
"httpx>=0.28.1",
"asyncstdlib>=3.13.1",
"webcolors>=24.11.1",
]

[[project.authors]]
Expand Down
11 changes: 11 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions webhook_server/config/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ properties:
description: Create a tracking issue for new pull requests (global default)
default: true

pr-size-thresholds:
type: object
description: Custom PR size thresholds with label names and colors
additionalProperties:
type: object
properties:
threshold:
type: integer
minimum: 1
description: Minimum number of changes (additions + deletions) for this size category
color:
type: string
description: CSS3 color name for the label (e.g., 'green', 'red', 'orange')
required:
- threshold
additionalProperties: false

branch-protection:
type: object
properties:
Expand Down Expand Up @@ -227,3 +244,19 @@ properties:
type: boolean
description: Create a tracking issue for new pull requests
default: true
pr-size-thresholds:
type: object
description: Custom PR size thresholds with label names and colors (repository-specific override)
additionalProperties:
type: object
properties:
threshold:
type: integer
minimum: 1
description: Minimum number of changes (additions + deletions) for this size category
color:
type: string
description: CSS3 color name for the label (e.g., 'green', 'red', 'orange')
required:
- threshold
additionalProperties: false
Loading