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 c1b53c7 commit 758c130
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 758c130

Please sign in to comment.