Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs(style): add custom vale ci check (#7835)

Adrian Kahaliddfe9eba10e1
diff --git a/.github/workflows/check-docs-style.yml b/.github/workflows/check-docs-style.yml
new file mode 100644
index 0000000000..67d6a2df18
--- /dev/null
+++ b/.github/workflows/check-docs-style.yml
@@ -0,0 +1,87 @@
+name: Check docs style
+
+on:
+ pull_request:
+ types: [opened, synchronize]
+ workflow_dispatch:
+ inputs:
+ scope:
+ description: Files to lint
+ type: choice
+ options:
+ - changed
+ - all
+ default: changed
+
+jobs:
+ changes:
+ name: Detect docs changes
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: read
+ outputs:
+ docs: ${{ steps.detect.outputs.docs }}
+ steps:
+ - name: Look for docs in the pull request diff
+ id: detect
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ GH_TOKEN: ${{ github.token }}
+ REPO: ${{ github.repository }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ run: |
+ if [ "$EVENT_NAME" != "pull_request" ]; then
+ echo "docs=true" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+
+ files="$(gh api "repos/${REPO}/pulls/${PR_NUMBER}/files" --paginate --jq '.[].filename')"
+
+ if printf '%s\n' "$files" | grep -Eq '^docs/|^\.github/workflows/check-docs-style\.yml$'; then
+ echo "docs=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "docs=false" >> "$GITHUB_OUTPUT"
+ echo "No files under docs/ in this pull request. Skipping Vale."
+ fi
+
+ vale:
+ name: Vale
+ needs: changes
+ if: needs.changes.outputs.docs == 'true'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 Nov 14, 2025
+ with:
+ fetch-depth: 0
+
+ - name: Install Vale
+ run: |
+ set -euo pipefail
+
+ VERSION="$(cat docs/.vale-version)"
+ TARBALL="vale_${VERSION}_Linux_64-bit.tar.gz"
+ BASE="https://github.com/errata-ai/vale/releases/download/v${VERSION}"
+
+ curl -fsSL -o "$TARBALL" "$BASE/$TARBALL"
+ curl -fsSL -o vale-checksums.txt "$BASE/vale_${VERSION}_checksums.txt"
+ grep " $TARBALL\$" vale-checksums.txt | sha256sum -c -
+
+ tar -xzf "$TARBALL" vale
+ sudo install -m 0755 vale /usr/local/bin/vale
+ rm -f "$TARBALL" vale-checksums.txt vale
+
+ vale --version
+
+ - name: Lint documentation
+ env:
+ SCOPE: ${{ inputs.scope || 'changed' }}
+ BASE_REF: ${{ github.base_ref || github.event.repository.default_branch }}
+ run: |
+ if [ "$SCOPE" = "all" ]; then
+ ./docs/scripts/lint-docs.sh --all
+ else
+ ./docs/scripts/lint-docs.sh --changed --base "origin/${BASE_REF}"
+ fi
diff --git a/AGENTS.md b/AGENTS.md
index b95036eb91..5b9085d52d 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -16,7 +16,7 @@ Some of it needs judgment rather than a mechanical check. The deadlock rules can
When writing or editing documentation in `docs/`, follow the [Documentation Style Guide](docs/STYLE_GUIDE.md). It covers writing for users (not implementers), Mintlify component usage, cross-referencing, page structure, and more.
-Run `make lint-docs` after any change under `docs/`. It runs [Vale](https://vale.sh) over the docs and enforces the mechanical half of the style guide. A clean run is not a substitute for reading the guide: the judgment calls it cannot check are the ones that matter most. Vale cannot see prose indented inside Mintlify components, so a clean run is not evidence that nested content was checked.
+Run `make lint-docs-branch` after any change under `docs/` (or `make lint-docs` for the whole site; the `Check docs style` CI check runs the branch variant). It runs [Vale](https://vale.sh) over the docs and enforces the mechanical half of the style guide. A clean run is not a substitute for reading the guide: the judgment calls it cannot check are the ones that matter most. Vale cannot see prose indented inside Mintlify components, so a clean run is not evidence that nested content was checked.
## UI Development
diff --git a/CLAUDE.md b/CLAUDE.md
index 8f72b1122a..b72aa37c38 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -80,7 +80,7 @@ The v3 visual system (colors, typography, components, layout) and product voice/
When writing or editing documentation in `docs/`, follow the [Documentation Style Guide](docs/STYLE_GUIDE.md). It covers writing for users (not implementers), Mintlify component usage, cross-referencing, page structure, and more.
-Run `make lint-docs` after any change under `docs/`. It runs [Vale](https://vale.sh) over the docs and enforces the mechanical half of the style guide: sentence case in headings and frontmatter titles, product and vendor spellings, spelling against a curated vocabulary, `$` prompts in code blocks, and em dash density. See [docs/CONTRIBUTING.MD](docs/CONTRIBUTING.MD) for how to extend the vocabulary or suppress a rule. It is the same invocation Mintlify's Vale CI check runs, so local and CI agree. Note that Vale cannot see prose indented four or more spaces inside components -- roughly half of this repo -- and reports nothing about what it skipped, so a clean run does not mean a nested page was checked.
+Run `make lint-docs` after any change under `docs/`. It runs [Vale](https://vale.sh) over the docs and enforces the mechanical half of the style guide: sentence case in headings and frontmatter titles, product and vendor spellings, spelling against a curated vocabulary, `$` prompts in code blocks, and em dash density. See [docs/CONTRIBUTING.MD](docs/CONTRIBUTING.MD) for how to extend the vocabulary or suppress a rule. `make lint-docs-branch` runs the same rules over only the `.mdx` files the branch touched. The `Check docs style` GitHub workflow runs that same script, so local and CI agree by construction. Note that Vale cannot see prose indented four or more spaces inside components -- roughly half of this repo -- and reports nothing about what it skipped, so a clean run does not mean a nested page was checked.
### Auth & Permissions
diff --git a/Makefile b/Makefile
index dd2e1a1cd3..f1764fdbc1 100644
--- a/Makefile
+++ b/Makefile
@@ -39,8 +39,10 @@ reviewable-api:
reviewable: reviewable-ui reviewable-api
lint-docs:
- @command -v vale >/dev/null || { echo "vale not found. Install it with: brew install vale"; exit 1; }
- cd docs && vale --glob='*.mdx' .
+ @./docs/scripts/lint-docs.sh --all
+
+lint-docs-branch:
+ @./docs/scripts/lint-docs.sh --changed
up-dev-oidc:
docker compose -f docker-compose.dev.yml --profile oidc up --build
diff --git a/docs/.vale-version b/docs/.vale-version
new file mode 100644
index 0000000000..58baf7b990
--- /dev/null
+++ b/docs/.vale-version
@@ -0,0 +1 @@
+3.17.1
diff --git a/docs/CONTRIBUTING.MD b/docs/CONTRIBUTING.MD
index a3430b1eaf..8ab346d0be 100644
--- a/docs/CONTRIBUTING.MD
+++ b/docs/CONTRIBUTING.MD
@@ -16,14 +16,27 @@ linter from the repository root:
```
brew install vale
-make lint-docs
+make lint-docs-branch # only the .mdx files this branch touched
+make lint-docs # every .mdx file in docs/
```
-The configuration lives in `docs/.vale.ini` and `docs/.vale/styles/`. Vale 3.17.1 or later is
-expected; the config pins `.mdx` to the Markdown parser, so behavior is tied to the version.
-
-`make lint-docs` is the same `vale` invocation that Mintlify's Vale CI check runs, so local
-and CI results match. You can also run `vale <path>` directly on a subset.
+The configuration lives in `docs/.vale.ini` and `docs/.vale/styles/`. The Vale version CI
+installs is pinned in `docs/.vale-version`, and both targets warn when the version you have
+installed differs. CI verifies the download against the checksums published with that
+release. The config pins `.mdx` to the Markdown parser, so behavior is tied to the
+version.
+
+Both targets call `docs/scripts/lint-docs.sh`, and so does the `Check docs style` GitHub
+workflow, which runs only on pull requests that touch `docs/` and lints the files the pull
+request changed. A branch that edits the configuration itself -- `.vale.ini`, a file under
+`.vale/styles/`, `.vale-version`, or the script -- is linted in full instead, since a rule
+change reaches pages the branch never touched. Local and CI results therefore match. You can
+also run `vale <path>` directly on a subset. A run fails only on errors; warnings and
+suggestions are printed but do not block.
+
+Mintlify runs its own Vale check against this same config, and its results do not always
+agree with ours -- it is a separate build we do not control. `Check docs style` is the check
+to go by.
What it checks: sentence case in headings and in the `title`/`sidebarTitle` frontmatter
fields, the enforced spellings in
diff --git a/docs/STYLE_GUIDE.md b/docs/STYLE_GUIDE.md
index 101e9326ed..66af00abaa 100644
--- a/docs/STYLE_GUIDE.md
+++ b/docs/STYLE_GUIDE.md
@@ -398,8 +398,10 @@ Use the structure that best serves the reader for that type of content.
## 12. What Vale enforces
-Some of this guide is checked by [Vale](https://vale.sh). Run `make lint-docs` from the
-repository root before opening a documentation pull request.
+Some of this guide is checked by [Vale](https://vale.sh). Run `make lint-docs-branch` from
+the repository root before opening a documentation pull request, or `make lint-docs` to check
+every page. The `Check docs style` CI check runs the same rules over the files the pull request
+touched.
Vale cannot see prose indented inside components, which is a large share of this repo. A clean
run is not evidence that a nested page was checked. See `docs/CONTRIBUTING.MD` for the detail.
diff --git a/docs/scripts/lint-docs.sh b/docs/scripts/lint-docs.sh
new file mode 100755
index 0000000000..f2595c00ad
--- /dev/null
+++ b/docs/scripts/lint-docs.sh
@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+#
+# Runs Vale over the documentation. Both `make lint-docs` and the GitHub
+# workflow call this script so local and CI results cannot drift apart.
+#
+# lint-docs.sh --all every .mdx file under docs/
+# lint-docs.sh --changed [--base <ref>] only .mdx files this branch touched, or every
+# file when the branch changes a lint input
+#
+# Exits non-zero when Vale reports an error.
+
+set -euo pipefail
+
+REPO_ROOT="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
+DOCS_DIR="$REPO_ROOT/docs"
+
+MODE=all
+BASE=main
+
+LINT_INPUTS='^docs/\.vale\.ini$|^docs/\.vale/|^docs/\.vale-version$|^docs/scripts/lint-docs\.sh$'
+
+usage() {
+ echo "Usage: lint-docs.sh [--all | --changed] [--base <ref>]" >&2
+}
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --all) MODE=all; shift ;;
+ --changed) MODE=changed; shift ;;
+ --base) BASE="${2:-}"; [ -n "$BASE" ] || { usage; exit 2; }; shift 2 ;;
+ -h|--help) usage; exit 0 ;;
+ *) echo "unknown argument: $1" >&2; usage; exit 2 ;;
+ esac
+done
+
+if ! command -v vale >/dev/null 2>&1; then
+ echo "vale not found. Install it with: brew install vale" >&2
+ exit 1
+fi
+
+PINNED_VERSION="$(tr -d '[:space:]' < "$DOCS_DIR/.vale-version")"
+INSTALLED_VERSION="$(vale --version | awk '{print $NF}')"
+if [ "$INSTALLED_VERSION" != "$PINNED_VERSION" ]; then
+ echo "warning: vale $INSTALLED_VERSION is installed but CI runs $PINNED_VERSION." >&2
+ echo " Results may differ. Upgrade with: brew upgrade vale" >&2
+fi
+
+cd "$DOCS_DIR"
+
+if [ "$MODE" = "all" ]; then
+ exec vale --glob='*.mdx' .
+fi
+
+if ! MERGE_BASE="$(git -C "$REPO_ROOT" merge-base "$BASE" HEAD 2>/dev/null)"; then
+ echo "error: no merge base between '$BASE' and HEAD. Pass --base <ref> to pick another base branch." >&2
+ exit 1
+fi
+
+CHANGED="$(
+ {
+ git -C "$REPO_ROOT" diff --name-only "$MERGE_BASE" -- docs
+ git -C "$REPO_ROOT" ls-files --others --exclude-standard -- docs
+ } | sort -u
+)"
+
+if printf '%s\n' "$CHANGED" | grep -Eq "$LINT_INPUTS"; then
+ echo "Lint configuration changed. Linting every .mdx file instead of just the branch's."
+ echo
+ exec vale --glob='*.mdx' .
+fi
+
+FILES=()
+while IFS= read -r path; do
+ case "$path" in
+ *.mdx) ;;
+ *) continue ;;
+ esac
+ [ -f "$REPO_ROOT/$path" ] || continue
+ FILES+=("${path#docs/}")
+done <<< "$CHANGED"
+
+if [ ${#FILES[@]} -eq 0 ]; then
+ echo "No .mdx files changed against $BASE. Nothing to lint."
+ exit 0
+fi
+
+echo "Linting ${#FILES[@]} file(s) changed against $BASE:"
+printf ' %s\n' "${FILES[@]}"
+echo
+
+exec vale --glob='*.mdx' "${FILES[@]}"
diff --git a/docs/self-hosting/guides/rotating-the-encryption-key.mdx b/docs/self-hosting/guides/rotating-the-encryption-key.mdx
index e272ed51f2..5e252eeafa 100644
--- a/docs/self-hosting/guides/rotating-the-encryption-key.mdx
+++ b/docs/self-hosting/guides/rotating-the-encryption-key.mdx
@@ -1,5 +1,5 @@
---
-title: "Rotating the Encryption Key"
+title: "Rotating the encryption key"
description: "Replace the ENCRYPTION_KEY protecting your Infisical instance"
---