From eee1c68608be644799edcbb898b803389aef706b Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Tue, 15 Oct 2024 16:04:15 +0100 Subject: [PATCH] update --- .github/workflows/vale.yml | 41 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index 902c25ce31d..a3175e89efb 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -58,30 +58,31 @@ jobs: fi done - - name: Run Vale on changed lines + - name: Run Vale on changed lines and capture output if: ${{ steps.changed-files.outputs.any_changed == 'true' }} id: vale-lint - uses: errata-ai/vale-action@reviewdog - with: - token: ${{ secrets.GITHUB_TOKEN }} - reporter: github-check # Annotations will be posted in the PR - level: error # Report as errors to make issues clearer - filter_mode: added # Only analyze changed lines - files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }} - separator: ' ' - version: '2.27.0' - continue-on-error: true # Ensure workflow continues even if Vale finds issues + run: | + /home/runner/vale --output=vale-output.json website/docs/docs/introduction.md || true - - name: Post summary comment if Vale finds issues - if: always() # Always evaluate the step + - name: Check Vale output for warnings/issues + id: check-vale-output run: | - CHECK_RUN_URL="${{ steps.vale-lint.outputs.check_run_url }}" - if [[ "$CHECK_RUN_URL" == *"warning"* ]]; then - COMMENT="❗️Oh no, some Vale linting issues were found! Please check the **Files changed** tab for detailed results and make the necessary updates." - COMMENT+=$'\n' - COMMENT+=$'\n\n' - COMMENT+="➡️ Link to detailed report: [Files changed](${{ github.event.pull_request.html_url }}/files)" - gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT" + if grep -q '"severity": "WARNING"' vale-output.json; then + echo "Vale found warnings or issues." + echo "has_warnings=true" >> $GITHUB_ENV + else + echo "No warnings or issues found." + echo "has_warnings=false" >> $GITHUB_ENV fi + + - name: Post summary comment if Vale finds issues + if: ${{ env.has_warnings == 'true'}} + run: | + COMMENT="❗️Oh no, some Vale linting issues were found! Please check the **Files changed** tab for detailed results and make the necessary updates." + COMMENT+=$'\n' + COMMENT+=$'\n\n' + COMMENT+="➡️ Link to detailed report: [Files changed](${{ github.event.pull_request.html_url }}/files)" + gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + has_warnings: ${{ env.has_warnings }}