diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13a51cf36cd2..fcafdecc7542 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,17 +68,6 @@ jobs: AWS_CLOUDFRONT_ID: 0123456789ABCD AWS_LAMBDA_FUNCTION: DockerDocsRedirectFunction-dummy - 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 - validate: runs-on: ubuntu-24.04 strategy: @@ -86,6 +75,7 @@ jobs: matrix: target: - lint + - vale - test - unused-media - test-go-redirects @@ -93,6 +83,9 @@ jobs: - path-warnings - validate-vendor steps: + - + name: Checkout + uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -100,8 +93,18 @@ jobs: name: Validate uses: docker/bake-action@v6 with: + source: . files: | docker-bake.hcl targets: ${{ matrix.target }} - set: | - *.args.BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 + - + name: Install reviewdog + if: ${{ matrix.target == 'vale' && github.event_name == 'pull_request' }} + uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893 # v1.3.2 + - + name: Run reviewdog for vale + if: ${{ matrix.target == 'vale' && github.event_name == 'pull_request' }} + run: | + cat ./tmp/vale.out | reviewdog -f=rdjsonl -name=vale -reporter=github-pr-annotations -fail-on-error=false -filter-mode=added -level=info + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.vale-rdjsonl.tmpl b/.vale-rdjsonl.tmpl new file mode 100644 index 000000000000..662f973385c2 --- /dev/null +++ b/.vale-rdjsonl.tmpl @@ -0,0 +1,31 @@ +{{- /* Range over the linted files */ -}} + +{{- range .Files}} + +{{- $path := .Path -}} + +{{- /* Range over the file's alerts */ -}} + +{{- range .Alerts -}} + +{{- $error := "" -}} +{{- if eq .Severity "error" -}} + {{- $error = "ERROR" -}} +{{- else if eq .Severity "warning" -}} + {{- $error = "WARNING" -}} +{{- else -}} + {{- $error = "INFO" -}} +{{- end}} + +{{- /* Variables setup */ -}} + +{{- $line := printf "%d" .Line -}} +{{- $col := printf "%d" (index .Span 0) -}} +{{- $check := printf "%s" .Check -}} +{{- $message := printf "%s" .Message -}} + +{{- /* Output */ -}} + +{"message": "[{{ $check }}] {{ $message | jsonEscape }}", "location": {"path": "{{ $path }}", "range": {"start": {"line": {{ $line }}, "column": {{ $col }}}}}, "severity": "{{ $error }}"} +{{end -}} +{{end -}} diff --git a/Dockerfile b/Dockerfile index 26ec7f74e2aa..60edca09d4ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ ARG ALPINE_VERSION=3.21 ARG GO_VERSION=1.24 ARG HTMLTEST_VERSION=0.17.0 +ARG VALE_VERSION=3.11.2 ARG HUGO_VERSION=0.141.0 ARG NODE_VERSION=22 ARG PAGEFIND_VERSION=1.3.0 @@ -67,6 +68,23 @@ COPY --from=build /project/public ./public ADD .htmltest.yml .htmltest.yml RUN htmltest +# vale +FROM jdkato/vale:v${VALE_VERSION} AS vale-run +WORKDIR /src +ARG GITHUB_ACTIONS +RUN --mount=type=bind,target=.,rw <