Skip to content

Quality Gates

Quality gates are named sets of metric thresholds that evaluate repo health. When a gate fails on a PR, GitWire posts a failure check status on GitHub — which can be configured as a required status check to block the merge.

Quick Start

1. Define gates in .gitwire.yml

yaml
quality_gates:
  default:
    conditions:
      - metric: ci_failure_rate_7d
        operator: "<"
        threshold: 0.3
      - metric: triage_coverage
        operator: ">="
        threshold: 0.5
      - metric: readiness_score
        operator: ">="
        threshold: 40

2. Make it a required status check in GitHub

  1. Go to Settings → Branches → Branch protection rules in your repo
  2. Add rule for your main branch
  3. Check Require status checks to pass before merging
  4. Search for gitwire/quality-gate and select it

Now PRs can't be merged if any gate condition fails.

Default Gate

GitWire ships with a default gate applied to all repos:

ConditionMetricOperatorThreshold
CI failure rate (7d)ci_failure_rate_7d<0.3 (30%)
Triage coveragetriage_coverage>=0.5 (50%)
Readiness scorereadiness_score>=40/100

Configuration

Multiple Gates

yaml
quality_gates:
  default:
    conditions:
      - metric: ci_failure_rate_7d
        operator: "<"
        threshold: 0.3

  strict:
    conditions:
      - metric: ci_failure_rate_7d
        operator: "<"
        threshold: 0.1
      - metric: triage_coverage
        operator: ">="
        threshold: 0.8
      - metric: heal_success_rate_7d
        operator: ">="
        threshold: 0.5
      - metric: readiness_score
        operator: ">="
        threshold: 70

Non-Blocking Gates

Set block_on_fail: false for informational gates that don't block merges:

yaml
quality_gates:
  informational:
    conditions:
      - metric: avg_triage_time_hours
        operator: "<="
        threshold: 24
    block_on_fail: false

Operators

OperatorMeaning
<Less than
<=Less than or equal
>Greater than
>=Greater than or equal
==Equals
!=Not equals

Available Metrics

MetricTypeSourceDescription
ci_failure_rate_7dratio (0-1)ci_runsCI failure rate in last 7 days
ci_failure_rate_30dratio (0-1)ci_runsCI failure rate in last 30 days
triage_coverageratio (0-1)issues% of issues with triage classification
open_issuescountissuesNumber of open issues
open_security_issuescountissuesOpen issues labeled 'security'
stale_issues_7dcountissuesOpen issues with no activity in 7+ days
heal_success_rate_7dratio (0-1)heal_prs% of CI heal PRs merged in last 7 days
heal_success_rate_30dratio (0-1)heal_prs% of CI heal PRs merged in last 30 days
heal_efficacy_rate_7dratio (0-1) or nullmanaged_actionsOf merged heal PRs with outcome data, % where the next CI run passed (null if no data)
fix_success_rate_7dratio (0-1)fix_attempts% of fix attempts that succeeded in last 7 days
duplicate_rateratio (0-1)issues% of issues flagged as duplicates
avg_triage_time_hoursnumberissuesAverage hours from issue creation to triage
avg_heal_time_hoursnumberheal_prsAverage hours from CI failure to heal PR
readiness_scorenumber (0-100)computedRepo readiness score
webhook_events_7dcountwebhook_deliveriesWebhook events in last 7 days

How It Works

Evaluation Flow

PR Event → Webhook Pipeline → Quality Gate Evaluation → GitHub Check

                              Fetch 14 metrics from DB

                              Evaluate each condition

                         All pass → ✅ success check
                         Any fail → ❌ failure check

Pipeline Position

Quality gates evaluate after pillar workers and custom rules:

  1. Pillar workers (triage, heal, review) — process event
  2. Custom rules — evaluate expressions, dispatch actions
  3. Quality gates — evaluate metrics, post check status
  4. Response to GitHub

GitHub Check Details

The check name is gitwire/quality-gate — separate from the existing GitWire check so you can:

  • Require only the quality gate as a merge blocker
  • Keep the main GitWire check informational

The check summary includes a table with each condition, its threshold, the actual value, and pass/fail status.

Dashboard

The Quality Gates page (/gates) shows:

  • Fleet summary: X/Y repos passing all gates
  • Per-repo detail: gate conditions, actual values, pass/fail
  • Create/delete gates: manage gates from the dashboard
  • Evaluate Now: trigger manual evaluation
  • Raw metrics: view all 14 metric values for a repo

API

See Quality Gates API for endpoint documentation.

Released under the MIT License.