Skip to main content
mehen offers two per-metric gating mechanisms: repository-local mehen.toml thresholds evaluated inside the binary against absolute values, and the GitHub Action’s thresholds input evaluated against per-file deltas. This page explains how they differ, how they compose with the JSON output of mehen diff, and how to write your own gating logic in CI.

Repository thresholds (mehen.toml)

A mehen.toml at the repository root gates every command — locally, in pre-commit hooks, and in any CI system:
mehen metrics, mehen diff (head side), and mehen top-offenders exit 1 when a reported metric crosses its limit, after a grouped stderr report that names the config table to adjust. Limits bound where a metric may be: a file over the limit fails the gate even if the current change didn’t move it. Full reference: Configuration.

Action threshold input

The action runs mehen diff and then evaluates each per-file delta against the supplied limits. A violation:
  • Counts toward the violations output.
  • Fails the action when fail-on-threshold: true (default).
Delta limits bound how far a single PR may move a metric in the adverse direction; they say nothing about the absolute level a file already sits at. Combine them with mehen.toml thresholds to bound both.

Adverse direction

Each metric has an adverse direction. Thresholds limit how far in the adverse direction a per-file delta is allowed to go: mehen knows the direction for the standard metrics and applies the threshold accordingly.

Composition with diff JSON

If you want richer logic than the action provides, run mehen diff -O json yourself and pipe the JSON into a CI script:
jq and the JSON shape give you full control. The downside: you reimplement adversity rules.

See also