Add Vale to the Lint (Docs) workflow (#57175)

* Add Vale to the Lint (Docs) workflow

Install and run Vale in the Lint (Docs) workflow in order to ensure that
the documentation has a consistent style. This approach downloads a
release from the Vale GitHub repository, extracts a precompiled binary,
and runs it on all docs files. It assumes that all Vale warnings and
errors are already resolved, so that any new ones would have been
introduced by the target pull request.

This is an alternative to using reviewdog, which was behind a security
incident (see #53162 for context). While reviewdog can inspect the diff
introduced by a PR and limit its checks to changed lines, this change
does not require reliance on an insecure dependency.

* Respond to camscale feedback

- Use the `--repo` flag instead of the `checkout` GHA job to download
  a Vale release.
- Perform an integrity check on the Vale archive.

* Respond to fheinecke feedback

Make sure environment variables are quoted.

* Print a note before Vale workflow runs

Indicate that it is possible to ignore Vale rules. This way, docs
authors do not need to be blocked on edge cases.
This commit is contained in:
Paul Gottschling
2025-08-05 18:44:09 -04:00
committed by GitHub
parent 5519dee8d4
commit 546232bc10
+19
View File
@@ -142,6 +142,25 @@ jobs:
working-directory: 'docs'
run: yarn markdown-lint
- name: Download vale
env:
GH_TOKEN: ${{ github.token }}
VALE_VERSION: 3.12.0
# The sha256 checksum must be changed based on the downloaded package
# when you update the Vale version.
VALE_SHA256SUM: 3f4ea05cd1f2291b660ecf11a77cbb6b544b0f3b780604ad183f63285611321b
run: |
VALE_FILENAME="vale_${VALE_VERSION}_Linux_64-bit.tar.gz"
gh release download "v${VALE_VERSION}" --repo="errata-ai/vale" --pattern="${VALE_FILENAME}"
sha256sum --check <<<"${VALE_SHA256SUM} ${VALE_FILENAME}"
tar -xvf "vale_${VALE_VERSION}_Linux_64-bit.tar.gz"
- name: Check docs style
working-directory: 'docs/content/current'
run: |
echo "Running Vale style checks. For information about ignoring Vale rules, see: https://vale.sh/docs/formats/mdx#comments"
"${GITHUB_WORKSPACE}/vale" --config docs/.vale.ini docs/pages
- name: Test the docs build
working-directory: docs
run: yarn build