Webhook icon
WorkingDirectory icon
Clone icon
Commands icon
Script icon
Log icon
If icon
Fail icon
Set icon

Vale Docs Style Gate with an Accepted-Alert Baseline

Lint every docs push with Vale, compare alerts with an accepted baseline in the KV store, block merges on new errors and log new warnings.

Categories
Infrastructure

Adding a prose linter to an existing documentation repository usually fails on day one: Vale reports hundreds of old alerts, the check is red on every pull request, and the team turns it off. This blueprint makes Vale enforceable from the first run. It lints every push with the repository's own .vale.ini and styles, compares the alerts with an accepted baseline of the base branch kept in the KV store, blocks the merge only when the push adds new error-level alerts, lists new warnings for the author, and moves the baseline forward on every clean run of the base branch, so fixed alerts can never come back unnoticed.

How it works

  1. on_push (io.kestra.plugin.core.trigger.Webhook) receives the repository's push webhook, ignores branch deletions and non-branch refs, and passes the repository URL, branch and default branch as inputs. It ships disabled: true.
  2. lint (io.kestra.plugin.core.flow.WorkingDirectory) keeps the steps in one working directory: clone (io.kestra.plugin.git.Clone) checks out the branch, and vale (io.kestra.plugin.scripts.shell.Commands) runs the official jdkato/vale:v3.24.0 image with vale sync and vale --output=JSON --no-exit, so alerts never crash the task and a broken config does.
  3. compare_with_baseline (io.kestra.plugin.scripts.python.Script) fingerprints each alert by rule, file and message (no line numbers, so editing a paragraph above an old alert does not make it new), counts them by severity, and compares the counts with the baseline read with kv(). A fingerprint whose count grows counts as new too. On the first run of the base branch the current alerts are adopted as the baseline.
  4. log_summary logs totals, accepted, new and fixed alerts; report_new_warnings lists new warnings at WARN level without blocking.
  5. gate (io.kestra.plugin.core.flow.If) runs block_merge (io.kestra.plugin.core.execution.Fail) with each new error and its file and line. A clean run on the base branch stores the current counts as the new baseline and appends its totals to the alert history (last 30 runs) with io.kestra.plugin.core.kv.Set, and logs the trend (for example errors 1 -> 0, warnings 1 -> 1); a clean run on another branch leaves both untouched until the merge.

What you get

  • A style gate that can be switched on for a repository with years of existing alerts.
  • Merges blocked only for errors the push introduced, with file, line, rule and message in the failure.
  • New warnings reported to the author on every push without blocking.
  • A baseline per repository and base branch that shrinks as old alerts are fixed, so a fixed alert that comes back on an older branch blocks the merge again.
  • An alert history per base branch in the KV store, with the error and warning trend logged on every clean run, plus the full Vale JSON report on every execution.

Who it's for

  • Documentation and developer-experience teams that maintain a Vale style guide.
  • Platform teams that want the same docs gate on many repositories without a CI job in each.

Why orchestrate this with Kestra

The difficult part of a linter gate is the state: what is already accepted, on which branch, when it may change, and whether the docs are getting better over time. Kestra keeps that state in the KV store per repository and base branch, starts the gate from the push webhook with a condition, runs Vale in its official container next to the comparison in one working directory, and turns the result into a pass, a warning or a blocked merge with If and Fail, with the report and the decision recorded on every execution.

Prerequisites

  • A documentation repository with a .vale.ini at its root and its styles (or Packages that vale sync can download).
  • A Kestra worker that can run containers (Docker or Kubernetes task runner) and pull jdkato/vale:v3.24.0 and python:3.12-slim.

Secrets

  • VALE_GATE_WEBHOOK_KEY: a long random key that becomes part of the webhook URL.
  • For a private repository, a Git token used as password in clone.

Quick start

  1. Execute the flow on the base branch (branch = base_branch = main) to adopt the current alerts as the baseline.
  2. Execute it on a branch that adds an error, for example a product name that one of your styles swaps, and check that block_merge names the file and line.
  3. Execute it on the base branch again: the accepted alerts no longer block, only new ones do.
  4. Add a push webhook in the docs repository pointing at /api/v1/main/executions/webhook/company.team/vale-docs-style-gate/<key> (JSON content type) and enable on_push.

How to extend

  • Post the result as a commit status or a pull-request comment with an HTTP request to the Git host's API.
  • Block on new warnings too, for repositories that have reached zero warnings.
  • Lint only the files changed by the push, taken from the webhook payload, for very large repositories.
  • Share one style package across repositories with Packages in .vale.ini; vale sync installs it on every run.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.