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 012e90c commit 879607b
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,40 @@ jobs:
echo "Changed files:"
echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}"
- name: Run Vale with reviewdog and show detailed annotations
- name: Run Vale with reviewdog
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
id: vale-lint
uses: errata-ai/vale-action@reviewdog
with:
token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-annotations # Use GitHub PR check reporter for detailed annotations
reporter: github-pr-check # Use GitHub PR check reporter for detailed annotations
level: warning # Flag warnings as issues
filter_mode: added # Only analyze changed lines
files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
separator: ' '
version: '2.27.0'
output: 'json' # Output the Vale results in JSON format for parsing

- name: Check for Vale warnings
id: check-vale-warnings
run: |
if [[ $(jq '.warnings | length' < vale-output.json) -gt 0 ]]; then
echo "Vale found warnings or linting issues."
echo "has_warnings=true" >> $GITHUB_ENV
else
echo "No warnings or linting issues found."
echo "has_warnings=false" >> $GITHUB_ENV
fi
continue-on-error: true

- name: Post comment if Vale finds issues
if: ${{ env.has_warnings == 'true' }}
run: |
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)"
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
has_warnings: ${{ env.has_warnings }}

0 comments on commit 879607b

Please sign in to comment.