Workflow to check links in markdown files #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Markdown Links | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
types: [opened, reopened, synchronize] | |
jobs: | |
markdown-link-check: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Set up Node.js (required for markdown-link-check) | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# Install markdown-link-check | |
- name: Install markdown-link-check | |
run: | | |
npm install -g markdown-link-check | |
# Find and check all Markdown files | |
- name: Check links in Markdown files | |
run: | | |
# Find all .md files and check their links | |
find . -name "*.md" | while read file; do | |
echo "Checking $file" | |
markdown-link-check "$file" -q || echo "$file contains broken links" | |
done |