From 758c130b4062fb090018ed2205d730652ba86938 Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Tue, 15 Oct 2024 16:14:27 +0100 Subject: [PATCH] update --- .github/workflows/vale.yml | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index 2ab6519bf54..1f6d3ff035e 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -58,35 +58,30 @@ jobs: fi done - - name: Run Vale on changed lines and capture output + - name: Run Vale and capture output if: ${{ steps.changed-files.outputs.any_changed == 'true' }} - uses: errata-ai/vale-action@reviewdog - with: - token: ${{ secrets.GITHUB_TOKEN }} - reporter: github-check - files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }} - separator: ' ' - version: '2.27.0' + id: vale-lint + run: | + /home/runner/vale --output=vale-output.json ${{ steps.changed-files.outputs.all_changed_and_modified_files }} || true - - name: Check Vale output for warnings/issues + - name: Check for Vale issues and exit with code 78 if found + if: ${{ steps.changed-files.outputs.any_changed == 'true' }} id: check-vale-output run: | - if grep -i 'warning' vale-output.json; then - echo "Vale found warnings or issues." - echo "has_warnings=true" >> $GITHUB_ENV + if grep -i '"severity":' vale-output.json; then + echo "Vale found issues." + exit 78 # Exit with code 78 to mark the job as neutral else - echo "No warnings or issues found." - echo "has_warnings=false" >> $GITHUB_ENV + echo "No issues found." fi + continue-on-error: true - name: Post summary comment if Vale finds issues - if: ${{ env.has_warnings == 'true'}} + if: steps.check-vale-output.outcome == 'neutral' # Check if the step exited with code 78 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 }}