Skip to content

feat: support running vale locally #22130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -103,6 +103,21 @@ $ docker buildx bake validate

If this command doesn't result in any errors, you're good to go!

#### Running Vale

Vale is a tool that checks for spelling and grammar errors in your text. To run Vale
for the content in the `content` directory, use the following command:

```console
$ make vale
```

You can also specify a different directory for Vale to check. For example:

```console
$ CONTENT_DIR="content/manuals/compose" make vale
```

## Content not edited here

CLI reference documentation is maintained in upstream repositories. It's
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Directory containing the content to validate. Default is "content".
# It can be overridden by setting the CONTENT_DIR environment variable.
# Example: CONTENT_DIR=content/manuals/compose make vale
CONTENT_DIR := $(or $(CONTENT_DIR), content)

# Docker image to use for vale.
VALE_IMAGE := jdkato/vale:latest

.PHONY: vale
vale: ## run vale
docker run --rm -v $(PWD):/docs \
-w /docs \
-e PIP_BREAK_SYSTEM_PACKAGES=1 \
$(VALE_IMAGE) $(CONTENT_DIR)
Comment on lines +6 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if we could have it running within our Dockerfile so it could be used with bake like lint:

  • docs/docker-bake.hcl

    Lines 48 to 52 in 9623874

    target "lint" {
    target = "lint"
    output = ["type=cacheonly"]
    provenance = false
    }
  • docs/Dockerfile

    Lines 53 to 60 in 9623874

    # lint lints markdown files
    FROM davidanson/markdownlint-cli2:v0.14.0 AS lint
    USER root
    RUN --mount=type=bind,target=. \
    /usr/local/bin/markdownlint-cli2 \
    "content/**/*.md" \
    "#content/manuals/engine/release-notes/*.md" \
    "#content/manuals/desktop/previous-versions/*.md"

Then we could just add a vale bake target to validate group?

docs/docker-bake.hcl

Lines 38 to 40 in 9623874

group "validate" {
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint", "path-warnings"]
}

And would probably be able to remove this ci job

vale:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: errata-ai/vale-action@reviewdog
env:
PIP_BREAK_SYSTEM_PACKAGES: 1
with:
files: content

And just add vale to this matrix

target:
- lint
- test
- unused-media
- test-go-redirects
- dockerfile-lint
- path-warnings
so we have a good sandbox that work both on ci and locally?

Copy link
Member Author

@mdelapenya mdelapenya Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to create a foundational knowledge on bake, but it seems reasonable to include the target as part of the current build system. I'd go with what you suggest


.PHONY: vendor
vendor: ## vendor hugo modules
./hack/vendor