Skip to content

Add GitHub action to run markdownlint on PRs #3

Add GitHub action to run markdownlint on PRs

Add GitHub action to run markdownlint on PRs #3

Workflow file for this run

name: Markdown lint
on:
pull_request:
branches: [master]
jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed markdown files
id: changed
run: |
files=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }}...HEAD -- '*.md')
if [ -z "$files" ]; then
echo "files=" >> "$GITHUB_OUTPUT"
echo "No changed markdown files found."
else
echo "files<<EOF" >> "$GITHUB_OUTPUT"
echo "$files" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
echo "Changed markdown files:"
echo "$files"
fi
- name: Install markdownlint
if: steps.changed.outputs.files != ''
run: sudo apt-get install -y markdownlint
- name: Run markdownlint
if: steps.changed.outputs.files != ''
run: echo "${{ steps.changed.outputs.files }}" | xargs mdl