From 2d158d6ef0701dcb646013cac1da74aab37160b8 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 2 Dec 2025 14:47:05 +0100 Subject: [PATCH 1/2] github-actions: support for vale validation --- .github/workflows/preview-build.yml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index 19c60bdb7..2e83c91bc 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -149,6 +149,7 @@ jobs: modified_files: ${{ steps.check-modified-file-detail.outputs.modified_files }} deleted_files: ${{ steps.check-modified-file-detail.outputs.deleted_files }} renamed_files: ${{ steps.check-modified-file-detail.outputs.renamed_files }} + any_changed_vale_files: ${{ steps.check-vale-files.outputs.any_changed }} steps: - name: Checkout if: contains(fromJSON('["push", "merge_group", "workflow_dispatch"]'), github.event_name) @@ -167,6 +168,15 @@ jobs: .github/** README.md + - name: Get vale files + if: contains(fromJSON('["pull_request""]'), github.event_name) + id: check-vale-files + uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1 + with: + files: | + docs/**/*.md + docs/**/*.adoc + - name: Get modified file detail if: contains(fromJSON('["merge_group", "pull_request", "pull_request_target"]'), github.event_name) id: check-modified-file-detail @@ -656,3 +666,27 @@ jobs: issue_number: prNum, body }); + + vale: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + deployments: none + id-token: none + needs: + - check + if: contains(fromJSON('["pull_request"]'), github.event_name) && needs.check.outputs.any_changed_vale_files == 'true' + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Run Vale Linter + uses: elastic/vale-rules/lint@main + + - name: Post Vale Results + uses: elastic/vale-rules/report@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} From 2b09d2e2fe778a215eb4b0ad578f897627afb588 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 2 Dec 2025 15:17:30 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- .github/workflows/preview-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index 2e83c91bc..287c52c0f 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -169,7 +169,7 @@ jobs: README.md - name: Get vale files - if: contains(fromJSON('["pull_request""]'), github.event_name) + if: contains(fromJSON('["pull_request_target"]'), github.event_name) id: check-vale-files uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1 with: @@ -676,7 +676,7 @@ jobs: id-token: none needs: - check - if: contains(fromJSON('["pull_request"]'), github.event_name) && needs.check.outputs.any_changed_vale_files == 'true' + if: contains(fromJSON('["pull_request_target"]'), github.event_name) && needs.check.outputs.any_changed_vale_files == 'true' steps: - name: Checkout uses: actions/checkout@v6