From 14f32e47c365a324d3a5d0503eedcc3a428d24f9 Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Tue, 15 Oct 2024 13:08:22 +0100 Subject: [PATCH] update --- .github/workflows/vale.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index 00582cdc8b7..5d18f12ffa0 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -58,7 +58,7 @@ jobs: fi done - - name: Run Vale with reviewdog and capture output + - name: Run Vale with reviewdog if: ${{ steps.changed-files.outputs.any_changed == 'true' }} id: vale-lint uses: errata-ai/vale-action@reviewdog @@ -70,23 +70,39 @@ jobs: separator: ' ' version: '2.27.0' + - name: Check if Vale output file exists + if: ${{ steps.changed-files.outputs.any_changed == 'true' }} + run: | + if [ -f "/home/runner/work/_actions/errata-ai/vale-action/reviewdog/lib/rdjsonl.tmpl" ]; then + echo "Vale output file exists." + cat /home/runner/work/_actions/errata-ai/vale-action/reviewdog/lib/rdjsonl.tmpl + else + echo "Vale output file not found." + exit 1 + fi + - name: Check Vale JSON output for issues if: ${{ steps.changed-files.outputs.any_changed == 'true' }} id: check-vale-issues run: | - vale_output=$(jq '.[] | select(.severity=="WARNING" or .severity=="ERROR")' /home/runner/work/_actions/errata-ai/vale-action/reviewdog/lib/rdjsonl.tmpl) - if [[ -n "$vale_output" ]]; then - echo "Vale found issues." - echo "vale_issues=true" >> $GITHUB_ENV + if [ -f "/home/runner/work/_actions/errata-ai/vale-action/reviewdog/lib/rdjsonl.tmpl" ]; then + vale_output=$(jq '.[] | select(.severity=="WARNING" or .severity=="ERROR")' /home/runner/work/_actions/errata-ai/vale-action/reviewdog/lib/rdjsonl.tmpl) + if [[ -n "$vale_output" ]]; then + echo "Vale found issues." + echo "vale_issues=true" >> $GITHUB_ENV + else + echo "No Vale issues found." + echo "vale_issues=false" >> $GITHUB_ENV + fi else - echo "No Vale issues found." + echo "Vale output file not found, skipping JSON check." echo "vale_issues=false" >> $GITHUB_ENV fi - name: Post summary comment if issues found if: env.vale_issues == 'true' run: | - COMMENT="❗️Oh no, some Vale linting found issues! Please check the **Files changed** tab for detailed results and make the necessary updates." + COMMENT="❗️Oh no, some Vale linting found issues! Please check the **Files change** 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)"