Skip to content

Commit 7d8c436

Browse files
committed
Filter md
1 parent 48d7d56 commit 7d8c436

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: .github/workflows/ci.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,20 @@ jobs:
2323
# source: https://stackoverflow.com/a/74268200
2424
run: |
2525
if ${{ github.event_name == 'pull_request' }}; then
26-
changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)
26+
changed_files=$(git diff --name-only -r HEAD^1 HEAD -z | grep '\.md$' -zZ | xargs -0)
2727
else
28-
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)
28+
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -z | grep '\.md$' -zZ | xargs -0)
2929
fi
30-
# filter out non-markdown files
31-
md_files=$(echo "$changed_files" | grep -E '\.md$')
32-
echo "changed_files: $md_files"
33-
echo "changed_files=$md_files" >> $GITHUB_ENV
30+
echo "changed_files: $changed_files"
31+
echo "changed_files=$changed_files" >> $GITHUB_OUTPUT
3432
- name: Lint
3533
uses: avto-dev/markdown-lint@v1
3634
with:
3735
args: '.'
3836
config: '.markdownlint.json'
3937
- name: Check links
4038
uses: lycheeverse/[email protected]
39+
if: ${{ steps.changed-files.outputs.changed_files != '' }}
4140
with:
4241
fail: true
4342
args: --verbose --no-progress --accept '100..=103,200..=299,300..=399' ${{ steps.changed-files.outputs.changed_files }}

0 commit comments

Comments
 (0)