Test-vale-again #838
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Vale linting | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- 'website/docs/**/*' | |
- 'website/blog/**/*' | |
- 'website/**/*' | |
jobs: | |
vale: | |
name: Vale linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: List repository contents | |
run: | | |
pwd | |
ls -R | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Vale | |
run: pip install vale==2.27.0 # Install a stable version of Vale | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v34 | |
with: | |
files: | | |
website/**/*.md | |
separator: ' ' | |
- name: Filter out deleted files | |
id: filter-files | |
run: | | |
# Separate the changed files into deleted and non-deleted | |
CHANGED_FILES="${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | |
DELETED_FILES="${{ steps.changed-files.outputs.deleted_files }}" | |
# Filter out the deleted files | |
FILES_TO_LINT="" | |
for file in $CHANGED_FILES; do | |
if [[ ! " $DELETED_FILES " =~ " $file " ]]; then | |
FILES_TO_LINT+="$file " | |
fi | |
done | |
# Trim trailing whitespace and set the output | |
FILES_TO_LINT=$(echo "$FILES_TO_LINT" | xargs) | |
echo "files_to_lint=$FILES_TO_LINT" >> $GITHUB_OUTPUT | |
- name: Debugging - Print files to lint | |
if: ${{ steps.changed-files.outputs.any_changed == 'true' }} | |
run: | | |
echo "Files to lint:" | |
echo "${{ steps.filter-files.outputs.files_to_lint }}" | |
- name: Run Vale | |
if: ${{ steps.filter-files.outputs.files_to_lint != '' }} | |
uses: errata-ai/vale-action@reviewdog | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
reporter: github-check | |
files: ${{ steps.filter-files.outputs.files_to_lint }} | |
separator: ' ' | |
version: '2.27.0' | |
- name: Skip Vale linting | |
if: ${{ steps.filter-files.outputs.files_to_lint == '' }} | |
run: echo "No files to lint, skipping Vale." |