Skip to content

Update broken-links.yml #61

Update broken-links.yml

Update broken-links.yml #61

Workflow file for this run

name: Check README for Broken Links
on:
push:
branches:
- main
jobs:
check-links:
runs-on: ubuntu-22.04
steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
# Step 3: Install the markdown-link-check tool globally
- name: Install markdown-link-check
run: npm install -g markdown-link-check
# Step 4: Check README links and log the results
- name: Check README links
id: check-links
run: |
# Run markdown-link-check and store the results
markdown-link-check --verbose README.md > link-check-results.txt || true
# Output the results for debugging
echo "::group::Link Check Results"
cat link-check-results.txt
echo "::endgroup::"
# Step 5: Analyze the results and annotate them
- name: Annotate Results
run: |
# Extract broken links and exclude any links from ./Assets
broken_links=$(grep -B 1 "✖" link-check-results.txt | grep -v "./Assets" || true)
# Count total links and broken links
total_links=$(grep -oE "