Skip to content

Commit c9d1a22

Browse files
committed
Add markdown lint action
1 parent deb0427 commit c9d1a22

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Markdown Lint and Fix
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "comfyui_embedded_docs/docs/**/*.md"
8+
9+
jobs:
10+
markdown-lint:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
fetch-depth: 0
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: "18"
27+
28+
- name: Install markdownlint-cli
29+
run: npm install -g markdownlint-cli
30+
31+
- name: Run markdown linting and fix
32+
run: |
33+
# Find all markdown files and fix linting issues
34+
find comfyui_embedded_docs/docs -name "*.md" -type f | while read file; do
35+
echo "Fixing linting issues for: $file"
36+
markdownlint --fix "$file" || true
37+
done
38+
39+
- name: Check for changes
40+
id: verify-changed-files
41+
run: |
42+
if [ -n "$(git status --porcelain)" ]; then
43+
echo "changed=true" >> $GITHUB_OUTPUT
44+
echo "Files have been modified by markdownlint"
45+
else
46+
echo "changed=false" >> $GITHUB_OUTPUT
47+
echo "No changes made by markdownlint"
48+
fi
49+
50+
- name: Commit changes
51+
if: steps.verify-changed-files.outputs.changed == 'true'
52+
run: |
53+
git config --local user.email "[email protected]"
54+
git config --local user.name "GitHub Action"
55+
git add comfyui_embedded_docs/docs/**/*.md
56+
git commit -m "Auto-fix markdown linting issues
57+
58+
🤖 Generated with GitHub Actions
59+
60+
Co-Authored-By: GitHub Action <[email protected]>" || exit 0
61+
62+
- name: Push changes
63+
if: steps.verify-changed-files.outputs.changed == 'true'
64+
uses: ad-m/github-push-action@master
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
branch: ${{ github.head_ref }}

0 commit comments

Comments
 (0)