Skip to content

Commit dfa615a

Browse files
committed
docs:change the way markdownlint is called as GH Action
change markdownlint to lint only changed files within a new PR
1 parent 1541f74 commit dfa615a

File tree

1 file changed

+32
-15
lines changed

1 file changed

+32
-15
lines changed

.github/workflows/test.yaml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,41 @@ jobs:
3434
name: Lint markdown content
3535
runs-on: ubuntu-latest
3636
steps:
37-
- name: Checkout Source code
38-
uses: actions/checkout@v4
37+
- name: Checkout Source code
38+
uses: actions/checkout@v4
3939

40-
- name: Use Node.js 18
41-
uses: actions/setup-node@v4
42-
with:
43-
node-version: 18
44-
cache: 'npm'
45-
cache-dependency-path: 'package-lock.json'
46-
registry-url: 'https://npm.pkg.github.com/'
47-
scope: '@apify-packages'
40+
- name: Get changed files
41+
id: changed-files
42+
uses: tj-actions/[email protected]
43+
with:
44+
files: |
45+
**/*.md
46+
**/*.mdx
47+
separator: ","
4848

49-
- name: Install Dependencies
50-
run: npm ci --force
51-
env:
52-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
- name: Use Node.js 18
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: 18
53+
cache: 'npm'
54+
cache-dependency-path: 'package-lock.json'
55+
registry-url: 'https://npm.pkg.github.com/'
56+
scope: '@apify-packages'
57+
58+
- name: Install Dependencies
59+
run: npm ci --force
60+
env:
61+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
62+
63+
- name: List and Lint Changed Markdown Files
64+
env:
65+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
66+
run: |
67+
IFS=',' read -ra FILE_ARRAY <<< "$ALL_CHANGED_FILES"
68+
for file in "${FILE_ARRAY[@]}"; do
69+
npx markdownlint "$file"
70+
done
5371
54-
- run: npm run lint:md
5572
5673
lint_code:
5774
name: Lint app code

0 commit comments

Comments
 (0)