Skip to content

Commit 2829ead

Browse files
webjunkiegewenyu99
andauthored
fix: make markdown-lint workflow run on all PRs (#13859)
Co-authored-by: Vincent (Wen Yu) Ge <[email protected]>
1 parent b37cbe4 commit 2829ead

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

.github/workflows/markdown-lint.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ name: Markdown Lint
22

33
on:
44
pull_request:
5-
paths:
6-
- '**.md'
7-
- '**.mdx'
8-
- '.markdownlint-cli2.jsonc'
9-
- '.github/workflows/markdown-lint.yml'
105

116
permissions:
127
contents: read
@@ -19,9 +14,26 @@ jobs:
1914
steps:
2015
- name: Checkout code
2116
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Get changed markdown files
21+
id: changed-files
22+
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
23+
with:
24+
files: |
25+
**/*.md
26+
**/*.mdx
27+
.markdownlint-cli2.jsonc
28+
.github/workflows/markdown-lint.yml
2229
2330
- name: Run markdownlint-cli2
24-
uses: DavidAnson/markdownlint-cli2-action@v21
31+
if: steps.changed-files.outputs.any_changed == 'true'
32+
uses: DavidAnson/markdownlint-cli2-action@30a0e04f1870d58f8d717450cc6134995f993c63
2533
with:
26-
globs: '**/*.{md,mdx}'
34+
globs: ${{ steps.changed-files.outputs.all_changed_files }}
2735
config: '.markdownlint-cli2.jsonc'
36+
37+
- name: Skip if no markdown files changed
38+
if: steps.changed-files.outputs.any_changed != 'true'
39+
run: echo "No markdown files changed, skipping lint"

0 commit comments

Comments
 (0)