This is an automated email from the ASF dual-hosted git repository.
delei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fesod.git
The following commit(s) were added to refs/heads/main by this push:
new d1c7a8a8 fix: Use GitHub Actions for markdown linting in `ci-docs`
(#718)
d1c7a8a8 is described below
commit d1c7a8a897840450fd0aa831bd0fec07041f6482
Author: ongdisheng <[email protected]>
AuthorDate: Sun Nov 30 05:47:29 2025 +0000
fix: Use GitHub Actions for markdown linting in `ci-docs` (#718)
---
.github/workflows/ci-docs.yml | 49 +++++++++++--------------------------------
1 file changed, 12 insertions(+), 37 deletions(-)
diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml
index 8fe1b368..1395a6b3 100644
--- a/.github/workflows/ci-docs.yml
+++ b/.github/workflows/ci-docs.yml
@@ -21,56 +21,25 @@ on:
pull_request:
paths:
- 'website/**'
- - '**/*.md'
jobs:
- lint-and-build:
+ build-and-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
-
- - name: Install markdownlint-cli2
- run: npm install -g markdownlint-cli2
-
- - name: Run markdownlint
- id: lint
- run: |
- if [ "${{ github.event_name }}" = "pull_request" ]; then
- CHANGED_MD=$(git diff --name-only origin/${{
github.event.pull_request.base.ref }}...${{ github.event.pull_request.head.ref
}} | grep -E '\.md$' || true)
- else
- CHANGED_MD=$(git diff-tree --no-commit-id --name-only -r ${{
github.sha }} | grep -E '\.md$' || true)
- fi
- if [ -n "$CHANGED_MD" ]; then
- markdownlint-cli2 "$CHANGED_MD" --config
website/.markdownlint-cli2.jsonc > lint-result.txt || true
- if [ -s lint-result.txt ]; then
- echo "Lint failed."
- # Output non-compliant file contents to comment-body.txt
- for file in $CHANGED_MD; do
- echo "\n---\n**$file Content:**\n" >> comment-body.txt
- echo '\n```markdown' >> comment-body.txt
- cat "$file" >> comment-body.txt
- echo '\n```' >> comment-body.txt
- done
- echo "\n---\n**Lint Results:**\n" >> comment-body.txt
- cat lint-result.txt >> comment-body.txt
- exit 1
- fi
- else
- echo "No markdown files changed, skipping lint."
- fi
-
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8
run_install: false
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+
- name: Enable corepack
working-directory: website
run: npm i -g --force corepack && corepack enable
@@ -82,3 +51,9 @@ jobs:
- name: Build website
working-directory: website
run: pnpm build
+
+ - name: Lint markdown files
+ uses:
DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e
+ with:
+ globs: 'website/**/*.md'
+ config: 'website/.markdownlint-cli2.jsonc'
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]