Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter out deleted files for vale #6318

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,41 @@ jobs:
website/**/*.md
separator: ' '

- name: Debugging - Print changed files
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
- name: Filter out deleted files
id: filter-files
run: |
echo "Changed files:"
echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}"
# 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 }}"

- name: Confirm files exist
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
run: |
echo "Checking if files exist..."
for file in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do
if [ -f "$file" ]; then
echo "Found: $file"
else
echo "File not found: $file"
exit 1
# 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

- name: Run vale
# 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.changed-files.outputs.all_changed_and_modified_files }}
files: ${{ steps.filter-files.outputs.files_to_lint }}
separator: ' '
version: '2.27.0'

# - name: Post summary comment
# if: ${{ steps.changed-files.outputs.any_changed == '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 }}
- name: Skip Vale linting
if: ${{ steps.filter-files.outputs.files_to_lint == '' }}
run: echo "No files to lint, skipping Vale."
2 changes: 1 addition & 1 deletion styles/custom/Repitition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ message: "'%s' is repeated!"
level: warning
alpha: true
tokens:
- '[^\s]+'
- '\b(\w+)\b'
Loading