Skip to content

Commit 09fc2ea

Browse files
jaredirishclaude
andcommitted
[ci] Scope markdown lint to changed files only
Pre-existing lint errors in unrelated recipes were blocking all PRs that touch any .md file. Now only lints markdown files changed in the PR, matching the pattern used by ob1-review.yml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3dfd3c6 commit 09fc2ea

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/markdown-lint.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,36 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Get changed markdown files
23+
id: changed
24+
run: |
25+
files=$(git diff --name-only origin/main...HEAD -- '*.md' 2>/dev/null || git diff --name-only HEAD~1 HEAD -- '*.md')
26+
if [ -z "$files" ]; then
27+
echo "No markdown files changed"
28+
echo "skip=true" >> $GITHUB_OUTPUT
29+
else
30+
echo "skip=false" >> $GITHUB_OUTPUT
31+
# Write files to a temporary glob file for markdownlint-cli2
32+
echo "$files" > /tmp/changed-md-files.txt
33+
echo "Changed markdown files:"
34+
cat /tmp/changed-md-files.txt
35+
fi
1936
2037
- name: Setup Node
38+
if: steps.changed.outputs.skip != 'true'
2139
uses: actions/setup-node@v4
2240
with:
2341
node-version: '20'
2442

2543
- name: Install markdownlint-cli2
44+
if: steps.changed.outputs.skip != 'true'
2645
run: npm install -g markdownlint-cli2
2746

28-
- name: Run markdownlint
29-
run: markdownlint-cli2 --config .github/.markdownlint.jsonc "**/*.md" "#node_modules"
47+
- name: Run markdownlint on changed files
48+
if: steps.changed.outputs.skip != 'true'
49+
run: |
50+
# Lint only the markdown files changed in this PR
51+
xargs markdownlint-cli2 --config .github/.markdownlint.jsonc < /tmp/changed-md-files.txt

0 commit comments

Comments
 (0)