Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Oct 15, 2024
1 parent 194b1e6 commit 14f32e4
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)"
Expand Down

0 comments on commit 14f32e4

Please sign in to comment.