Skip to content

Commit 0a37b5a

Browse files
ctauchenclaude
andcommitted
Fix Vale CI to parse space-separated file list correctly
Add separator: " " to the vale-action step so it correctly parses the space-separated file list instead of falling back to scanning the entire repo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fa43295 commit 0a37b5a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/vale.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,46 @@ jobs:
77
steps:
88
- name: Checkout repository
99
uses: actions/checkout@v6
10+
with:
11+
fetch-depth: 0
12+
- name: Get changed files
13+
id: changed
14+
run: |
15+
FILES=$(git diff --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} -- '*.md' '*.mdx')
16+
if [ -z "$FILES" ]; then
17+
echo "skip=true" >> "$GITHUB_OUTPUT"
18+
echo 'files=all' >> "$GITHUB_OUTPUT"
19+
else
20+
echo "skip=false" >> "$GITHUB_OUTPUT"
21+
JSON=$(echo "$FILES" | jq -R -s -c 'split("\n") | map(select(. != ""))')
22+
echo "files=$JSON" >> "$GITHUB_OUTPUT"
23+
fi
1024
- name: Enable Corepack
25+
if: steps.changed.outputs.skip == 'false'
1126
run: corepack enable
1227
- name: Setup Node.js with Yarn
28+
if: steps.changed.outputs.skip == 'false'
1329
uses: actions/setup-node@v6
1430
with:
1531
node-version: '22'
1632
cache: yarn
1733
- name: Install dependencies
34+
if: steps.changed.outputs.skip == 'false'
1835
run: yarn install --immutable
1936
- name: Install mdx2vast globally
37+
if: steps.changed.outputs.skip == 'false'
2038
run: npm install -g mdx2vast
2139
- name: Swap stuff
40+
if: steps.changed.outputs.skip == 'false'
2241
run: |
2342
sudo apt-get install ripgrep
24-
rg -l0 '\$\[[^\]]*\]' -g '*.mdx' -g '*.md' . | xargs -0 perl -i -pe 's/\$\[[^\]]*\]/PICKLEVAR/g'
43+
FILES=$(echo '${{ steps.changed.outputs.files }}' | jq -r '.[]' | tr '\n' ' ')
44+
if [ -n "$FILES" ]; then
45+
rg -l0 '\$\[[^\]]*\]' -- $FILES | xargs -0 perl -i -pe 's/\$\[[^\]]*\]/PICKLEVAR/g' || true
46+
fi
2547
- name: Run Vale with Reviewdog
48+
if: steps.changed.outputs.skip == 'false'
2649
uses: errata-ai/vale-action@reviewdog
2750
with:
51+
files: ${{ steps.changed.outputs.files }}
2852
fail_on_error: false

0 commit comments

Comments
 (0)