Reusable GitHub Action that runs markdownlint-cli2 on pull requests.
- Lint passes & no auto-fix changes → auto-approve the PR
- Lint fails or auto-fix produces changes → request changes with inline suggestions
name: markdownlint
on:
pull_request_target:
paths: ['**/*.md']
permissions:
contents: read
pull-requests: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout PR branch
run: gh pr checkout ${{ github.event.number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: project-trans/markdownlint-action@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}| Name | Required | Default | Description |
|---|---|---|---|
glob |
No | **/*.md |
Glob pattern for markdown files |
config |
No | Path to markdownlint config file | |
GITHUB_TOKEN |
Yes | GitHub token for PR reviews |