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 ba096a7 commit 7902f08
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 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
- name: Run Vale with reviewdog and capture output
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
id: vale-lint
uses: errata-ai/vale-action@reviewdog
Expand All @@ -71,12 +71,21 @@ jobs:
separator: ' '
version: '2.27.0'

- name: Add PR comment if Vale found issues
if: failure() # This will run only if the Vale step fails (warnings are treated as failures)
- name: Check Vale output for warnings
if: ${{ steps.vale-lint.conclusion == 'neutral' }} # Reviewdog treats warnings as 'neutral' conclusion
run: |
echo "Vale found warnings!"
echo "vale_issues=true" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Post comment if warnings were found
if: ${{ env.vale_issues == 'true' }}
run: |
COMMENT="❗️ Vale linting found warnings. Please check the **Files changed** tab for details."
COMMENT+=$'\n\n'
COMMENT+="➡️ View the details here: [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 }}
vale_issues: ${{ env.vale_issues }}

0 comments on commit 7902f08

Please sign in to comment.